1 package de.fhdw.wtf.context.model.collections;
2
3 import java.util.concurrent.ConcurrentHashMap;
4
5 import de.fhdw.wtf.context.model.Anything;
6
7
8
9
10
11
12
13
14
15 public class TransientMap<K extends Anything, V extends Anything> extends MutableMap<K, V> {
16
17
18
19
20 private final ConcurrentHashMap<K, V> internalMap;
21
22
23
24
25 public TransientMap() {
26 this.internalMap = new ConcurrentHashMap<>();
27 }
28
29 @Override
30 public void put(final K key, final V value) {
31 if (key == null || value == null) {
32 throw new NullPointerException();
33 }
34 this.internalMap.put(key, value);
35 }
36
37 @Override
38 public V get(final K key) {
39 if (key == null) {
40 throw new NullPointerException();
41 }
42 return this.internalMap.get(key);
43 }
44
45 @Override
46 public V remove(final K key) {
47 if (key == null) {
48 throw new NullPointerException();
49 }
50 return this.internalMap.remove(key);
51 }
52
53
54
55
56
57 }