K
- Class of the key for the map.V
- Class of the value for the map.public class ImmutableMapParameter<K,V>
extends java.lang.Object
implements java.util.Map<K,V>
Example of using map Builder:
{ @code Map<String, AttibuteValue> item = new ImmutableMapParameter.Builder<String, AttibuteValue>() .put("one", new AttibuteValue("1")) .put("two", new AttibuteValue("2")) .put("three", new AttibuteValue("3")).build(); }For small immutable maps (up to five entries), the
ImmutableMapParamter.of()
methods are preferred:
Map<String, AttibuteValue> item =
ImmutableMapParameter
.of("one", new AttributeValue("1"),
"two", new AttributeValue("2"),
"three", new AttributeValue("3"),
Modifier and Type | Class and Description |
---|---|
static class |
ImmutableMapParameter.Builder<K,V>
A convenient builder for creating ImmutableMapParameter instances.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DUPLICATED_KEY_MESSAGE |
private java.util.Map<K,V> |
map |
private static java.lang.String |
UNMODIFIABLE_MESSAGE |
Modifier | Constructor and Description |
---|---|
private |
ImmutableMapParameter(java.util.Map<K,V> map) |
Modifier and Type | Method and Description |
---|---|
static <K,V> ImmutableMapParameter.Builder<K,V> |
builder()
Returns a new MapParameterBuilder instance.
|
void |
clear()
Unsupported methods
|
boolean |
containsKey(java.lang.Object key)
Inherited methods
|
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
boolean |
equals(java.lang.Object o) |
V |
get(java.lang.Object key) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
static <K,V> ImmutableMapParameter<K,V> |
of(K k0,
V v0)
Returns an ImmutableMapParameter instance containing a single entry.
|
static <K,V> ImmutableMapParameter<K,V> |
of(K k0,
V v0,
K k1,
V v1)
Returns an ImmutableMapParameter instance containing two entries.
|
static <K,V> ImmutableMapParameter<K,V> |
of(K k0,
V v0,
K k1,
V v1,
K k2,
V v2)
Returns an ImmutableMapParameter instance containing three entries.
|
static <K,V> ImmutableMapParameter<K,V> |
of(K k0,
V v0,
K k1,
V v1,
K k2,
V v2,
K k3,
V v3)
Returns an ImmutableMapParameter instance containing four entries.
|
static <K,V> ImmutableMapParameter<K,V> |
of(K k0,
V v0,
K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4)
Returns an ImmutableMapParameter instance containing five entries.
|
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> map) |
private static <K,V> void |
putAndWarnDuplicateKeys(java.util.Map<K,V> map,
K key,
V value) |
V |
remove(java.lang.Object key) |
int |
size() |
java.lang.String |
toString() |
java.util.Collection<V> |
values() |
private static final java.lang.String UNMODIFIABLE_MESSAGE
private static final java.lang.String DUPLICATED_KEY_MESSAGE
public static <K,V> ImmutableMapParameter.Builder<K,V> builder()
public static <K,V> ImmutableMapParameter<K,V> of(K k0, V v0)
k0
- Key of the single entry.v0
- Value of the single entry.public static <K,V> ImmutableMapParameter<K,V> of(K k0, V v0, K k1, V v1)
k0
- Key of the first entry.v0
- Value of the first entry.k1
- Key of the second entry.v1
- Value of the second entry.public static <K,V> ImmutableMapParameter<K,V> of(K k0, V v0, K k1, V v1, K k2, V v2)
k0
- Key of the first entry.v0
- Value of the first entry.k1
- Key of the second entry.v1
- Value of the second entry.k2
- Key of the third entry.v2
- Value of the third entry.public static <K,V> ImmutableMapParameter<K,V> of(K k0, V v0, K k1, V v1, K k2, V v2, K k3, V v3)
k0
- Key of the first entry.v0
- Value of the first entry.k1
- Key of the second entry.v1
- Value of the second entry.k2
- Key of the third entry.v2
- Value of the third entry.k3
- Key of the fourth entry.v3
- Value of the fourth entry.public static <K,V> ImmutableMapParameter<K,V> of(K k0, V v0, K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
k0
- Key of the first entry.v0
- Value of the first entry.k1
- Key of the second entry.v1
- Value of the second entry.k2
- Key of the third entry.v2
- Value of the third entry.k3
- Key of the fourth entry.v3
- Value of the fourth entry.k4
- Key of the fifth entry.v4
- Value of the fifth entry.public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
private static <K,V> void putAndWarnDuplicateKeys(java.util.Map<K,V> map, K key, V value)
public boolean equals(java.lang.Object o)
public int hashCode()
public java.lang.String toString()
toString
in class java.lang.Object