aboutsummaryrefslogtreecommitdiff
path: root/src/net/pacien/util/IntrinsicMap.java
blob: c09965dc38eb4008ad9364c108e0ed1d742da9df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package net.pacien.util;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author pacien
 * 
 */
public class IntrinsicMap<K, V extends Mappable<K>> extends HashMap<K, V> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 804991277001317260L;

	/**
	 * 
	 */
	public IntrinsicMap() {
		super();
	}

	/**
	 * @param initialCapacity
	 */
	public IntrinsicMap(final int initialCapacity) {
		super(initialCapacity);
	}

	/**
	 * @param m
	 */
	public IntrinsicMap(final Map<? extends K, ? extends V> m) {
		super(m);
	}

	/**
	 * @param initialCapacity
	 * @param loadFactor
	 */
	public IntrinsicMap(final int initialCapacity, final float loadFactor) {
		super(initialCapacity, loadFactor);
	}

	public V put(final V value) {
		return super.put(value.getKey(), value);
	}

	@Override
	public V put(final K key, final V value) {
		return this.put(value);
	}

	public void putAll(final Collection<V> collection) {
		for (final V value : collection) {
			this.put(value);
		}
	}

}