public class PrettyLinkedHashMap<K,V> extends LinkedHashMap<K,V>
LinkedHashMap with a named key and value that returns a
pretty toString() representation in the form of a two column table
where the key/value pairs are listed in different rows :
+-------------------------------+ | Key | Values | +-------------------------------+ | age | [1] | | foo | [1] | | name | [Jeff Nelson, jeffery] | +-------------------------------+
A PrettyLinkedHashMap is suitable to use when displaying information
about a single record or document.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Method and Description |
|---|---|
static <K,V> PrettyLinkedHashMap<K,V> |
newPrettyLinkedHashMap()
Return an empty
PrettyLinkedHashMap with the default key and
value
names. |
static <K,V> PrettyLinkedHashMap<K,V> |
newPrettyLinkedHashMap(String keyName,
String valueName)
Return an empty TLinkedHashMap with the specified
keyName and
valueName. |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> map) |
PrettyLinkedHashMap<K,V> |
setKeyName(String name)
Set the keyName to
name. |
PrettyLinkedHashMap<K,V> |
setValueName(String name)
Set the valueName to
name |
String |
toString() |
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCodecompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putIfAbsent, remove, remove, replace, replace, sizepublic static <K,V> PrettyLinkedHashMap<K,V> newPrettyLinkedHashMap()
PrettyLinkedHashMap with the default key and
value
names.public static <K,V> PrettyLinkedHashMap<K,V> newPrettyLinkedHashMap(String keyName, String valueName)
keyName and
valueName.keyName - valueName - public PrettyLinkedHashMap<K,V> setKeyName(String name)
name.name - public PrettyLinkedHashMap<K,V> setValueName(String name)
namename - public String toString()
toString in class AbstractMap<K,V>