public class PrettyLinkedTableMap<R,C,V> extends LinkedHashMap<R,Map<C,V>> implements PrettyTableMap<R,C,V>
LinkedHashMap that simulates a sparse table where a row key
maps to a set of columns and each column maps to a value (e.g. Map[R, ->
Map[C -> V]]). This object has pretty toString() output that is
formatted as such:
+-----------------------------------------------------------+ | Record | name | gender | joinedBy | +-----------------------------------------------------------+ | 1416242356271000 | Deary Hudson | UNSPECIFIED | EMAIL | | 1416242356407000 | Jeff Nelson | UNSPECIFIED | EMAIL | | 1416242356436000 | Morgan Debaun | UNSPECIFIED | EMAIL | +-----------------------------------------------------------+
A PrettyLinkedTableMap is suitable for displaying information about
multiple records or documents.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Method and Description |
|---|---|
static <R,C,V> PrettyTableMap<R,C,V> |
create()
|
static <R,C,V> PrettyTableMap<R,C,V> |
create(String identifierColumnHeader)
|
static <R,C,V> PrettyLinkedTableMap<R,C,V> |
newPrettyLinkedTableMap()
Deprecated.
use
create() instead |
static <R,C,V> PrettyLinkedTableMap<R,C,V> |
newPrettyLinkedTableMap(String identifierColumnHeader)
Deprecated.
use
create(String) instead |
static <R,C,V> PrettyTableMap<R,C,V> |
of(Map<R,Map<C,V>> data)
|
static <R,C,V> PrettyTableMap<R,C,V> |
of(Map<R,Map<C,V>> data,
String identifierColumnHeader)
|
V |
put(R row,
C column,
V value)
Insert
value under column in row. |
Map<C,V> |
put(R key,
Map<C,V> value)
THIS METHOD ALWAYS RETURNS
null. |
void |
putAll(Map<? extends R,? extends Map<C,V>> m) |
PrettyLinkedTableMap<R,C,V> |
setIdentifierColumnHeader(String header)
Set the identifierColumnHeader to
header. |
PrettyLinkedTableMap<R,C,V> |
setRowName(String name)
Deprecated.
use
setIdentifierColumnHeader(String) instead |
String |
toString() |
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCodeclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic static <R,C,V> PrettyTableMap<R,C,V> create()
Mappublic static <R,C,V> PrettyTableMap<R,C,V> create(String identifierColumnHeader)
Map with "pretty" string
representation.
identifierColumnHeader is used as the header for the column that
contains the the identifier for each row in the "table".
identifierColumnHeader - Map@Deprecated public static <R,C,V> PrettyLinkedTableMap<R,C,V> newPrettyLinkedTableMap()
create() insteadPrettyLinkedTableMap with the default row name.@Deprecated public static <R,C,V> PrettyLinkedTableMap<R,C,V> newPrettyLinkedTableMap(String identifierColumnHeader)
create(String) insteadPrettyLinkedTableMap with the specified
identifierColumnHeader.identifierColumnHeader - public static <R,C,V> PrettyTableMap<R,C,V> of(Map<R,Map<C,V>> data)
Map containing all the entries from data
that "prettifies" its string representation
on-demand.
The returned Map copies, but does not "read through" to
data. It is mutable, but changes made to it are not reflected in
data and vice versa.
data - Map containing data that has pretty
toString() outputpublic static <R,C,V> PrettyTableMap<R,C,V> of(Map<R,Map<C,V>> data, String identifierColumnHeader)
Map containing all the entries from data
that "prettifies" its string representation
on-demand.
The returned Map copies, but does not "read through" to
data. It is mutable, but changes made to it are not reflected in
data and vice versa.
identifierColumnHeader is used as the header for the column that
contains the the identifier for each row in the "table".
data - identifierColumnHeader - Map containing data that has pretty
toString() outputpublic V put(R row, C column, V value)
TableMapvalue under column in row.public PrettyLinkedTableMap<R,C,V> setIdentifierColumnHeader(String header)
PrettyTableMapheader.setIdentifierColumnHeader in interface PrettyTableMap<R,C,V>@Deprecated public PrettyLinkedTableMap<R,C,V> setRowName(String name)
setIdentifierColumnHeader(String) insteadname.name -