Package com.google.common.collect
Class SingletonImmutableTable<R,C,V>
- java.lang.Object
-
- com.google.common.collect.AbstractTable<R,C,V>
-
- com.google.common.collect.ImmutableTable<R,C,V>
-
- com.google.common.collect.SingletonImmutableTable<R,C,V>
-
- All Implemented Interfaces:
Table<R,C,V>
,java.io.Serializable
@GwtCompatible class SingletonImmutableTable<R,C,V> extends ImmutableTable<R,C,V>
An implementation ofImmutableTable
that holds a single cell.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableTable
ImmutableTable.Builder<R,C,V>, ImmutableTable.SerializedForm
-
Nested classes/interfaces inherited from class com.google.common.collect.AbstractTable
AbstractTable.CellSet, AbstractTable.Values
-
Nested classes/interfaces inherited from interface com.google.common.collect.Table
Table.Cell<R,C,V>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) C
singleColumnKey
(package private) R
singleRowKey
(package private) V
singleValue
-
Constructor Summary
Constructors Constructor Description SingletonImmutableTable(Table.Cell<R,C,V> cell)
SingletonImmutableTable(R rowKey, C columnKey, V value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableMap<R,V>
column(C columnKey)
Returns a view of all mappings that have the given column key.ImmutableMap<C,java.util.Map<R,V>>
columnMap()
Returns a view that associates each column key with the corresponding map from row keys to values.(package private) ImmutableSet<Table.Cell<R,C,V>>
createCellSet()
(package private) ImmutableTable.SerializedForm
createSerializedForm()
Creates the common serialized form for this table.(package private) ImmutableCollection<V>
createValues()
ImmutableMap<R,java.util.Map<C,V>>
rowMap()
Returns a view that associates each row key with the corresponding map from column keys to values.int
size()
Returns the number of row key / column key / value mappings in the table.-
Methods inherited from class com.google.common.collect.ImmutableTable
builder, cellIterator, cellOf, cellSet, cellSpliterator, clear, columnKeySet, contains, containsValue, copyOf, of, of, put, putAll, remove, row, rowKeySet, toImmutableTable, toImmutableTable, values, valuesIterator, writeReplace
-
Methods inherited from class com.google.common.collect.AbstractTable
containsColumn, containsRow, equals, get, hashCode, isEmpty, toString, valuesSpliterator
-
-
-
-
Method Detail
-
column
public ImmutableMap<R,V> column(C columnKey)
Description copied from class:ImmutableTable
Returns a view of all mappings that have the given column key. For each row key / column key / value mapping in the table with that column key, the returned map associates the row key with the value. If no mappings in the table have the provided column key, an empty map is returned.Changes to the returned map will update the underlying table, and vice versa.
-
columnMap
public ImmutableMap<C,java.util.Map<R,V>> columnMap()
Description copied from class:ImmutableTable
Returns a view that associates each column key with the corresponding map from row keys to values. Changes to the returned map will update this table. The returned map does not supportput()
orputAll()
, orsetValue()
on its entries.In contrast, the maps returned by
columnMap().get()
have the same behavior as those returned byTable.column(C)
. Those maps may supportsetValue()
,put()
, andputAll()
.The value
Map<R, V>
instances in the returned map areImmutableMap
instances as well.
-
rowMap
public ImmutableMap<R,java.util.Map<C,V>> rowMap()
Description copied from class:ImmutableTable
Returns a view that associates each row key with the corresponding map from column keys to values. Changes to the returned map will update this table. The returned map does not supportput()
orputAll()
, orsetValue()
on its entries.In contrast, the maps returned by
rowMap().get()
have the same behavior as those returned byTable.row(R)
. Those maps may supportsetValue()
,put()
, andputAll()
.The value
Map<C, V>
instances in the returned map areImmutableMap
instances as well.
-
size
public int size()
Description copied from interface:Table
Returns the number of row key / column key / value mappings in the table.
-
createCellSet
ImmutableSet<Table.Cell<R,C,V>> createCellSet()
- Specified by:
createCellSet
in classImmutableTable<R,C,V>
-
createValues
ImmutableCollection<V> createValues()
- Specified by:
createValues
in classImmutableTable<R,C,V>
-
createSerializedForm
ImmutableTable.SerializedForm createSerializedForm()
Description copied from class:ImmutableTable
Creates the common serialized form for this table.- Specified by:
createSerializedForm
in classImmutableTable<R,C,V>
-
-