K
- The key type.V
- The value type.public final class ASortedMap<K,V> extends TreeMap<K,V>
TreeMap
.
Provides various convenience methods for creating and populating a sorted map with minimal code.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
ASortedMap()
Constructor.
|
ASortedMap(Comparator<K> c)
Constructor.
|
ASortedMap(Map<K,V> copy)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
ASortedMap<K,V> |
a(K k,
V v)
Add.
|
ASortedMap<K,V> |
aa(Map<K,V> c)
Add all.
|
String |
asString()
Convert to Simplified JSON.
|
String |
asString(WriterSerializer ws)
Convert to a string using the specified serializer.
|
static <K,V> ASortedMap<K,V> |
nullable(Map<K,V> c)
Creates a copy of the collection if it's not
|
static <K,V> ASortedMap<K,V> |
of()
Creates an empty map.
|
static <K,V> ASortedMap<K,V> |
of(K key,
V value)
Creates a map with one entry.
|
static <K,V> ASortedMap<K,V> |
of(Map<K,V> copy)
Creates a new map initialized with the specified contents.
|
String |
toString()
Convert to Simplified JSON.
|
SortedMap<K,V> |
unmodifiable()
Returns an unmodifiable view of this set.
|
static <K,V> SortedMap<K,V> |
unmodifiable(Map<K,V> c)
Convenience method for creating an unmodifiable list out of the specified collection.
|
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, values
equals, hashCode, isEmpty
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, getOrDefault, hashCode, isEmpty, merge, putIfAbsent, remove
public ASortedMap()
public ASortedMap(Comparator<K> c)
c
- Comparator to use for key comparison.public ASortedMap(Map<K,V> copy)
copy
- The map to copy.public static <K,V> ASortedMap<K,V> of()
public static <K,V> ASortedMap<K,V> of(K key, V value)
key
- Entry key.value
- Entry value.public static <K,V> ASortedMap<K,V> of(Map<K,V> copy)
copy
- Initialize with these contents. Can be public static <K,V> SortedMap<K,V> unmodifiable(Map<K,V> c)
c
- The collection to add.public static <K,V> ASortedMap<K,V> nullable(Map<K,V> c)
c
- The initial values.public ASortedMap<K,V> a(K k, V v)
Adds an entry to this map.
k
- The key.v
- The value.public ASortedMap<K,V> aa(Map<K,V> c)
Appends all the entries in the specified map to this map.
c
- The map to copy.public SortedMap<K,V> unmodifiable()
public String asString(WriterSerializer ws)
ws
- The serializer to use to serialize this collection.public String asString()
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.