Package com.google.common.collect
Class DenseImmutableTable<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.RegularImmutableTable<R,C,V>
-
- com.google.common.collect.DenseImmutableTable<R,C,V>
-
- All Implemented Interfaces:
Table<R,C,V>,java.io.Serializable
final class DenseImmutableTable<R,C,V> extends RegularImmutableTable<R,C,V>
ARegularImmutableTableoptimized for dense data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classDenseImmutableTable.Columnprivate classDenseImmutableTable.ColumnMapprivate static classDenseImmutableTable.ImmutableArrayMap<K,V>An immutable map implementation backed by an indexed nullable array.private classDenseImmutableTable.Rowprivate classDenseImmutableTable.RowMap-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableTable
ImmutableTable.Builder<R,C,V>, ImmutableTable.SerializedForm
-
Nested classes/interfaces inherited from interface com.google.common.collect.Table
Table.Cell<R,C,V>
-
-
Field Summary
Fields Modifier and Type Field Description private int[]cellColumnIndicesprivate int[]cellRowIndicesprivate int[]columnCountsprivate ImmutableMap<C,java.lang.Integer>columnKeyToIndexprivate ImmutableMap<C,ImmutableMap<R,V>>columnMapprivate int[]rowCountsprivate ImmutableMap<R,java.lang.Integer>rowKeyToIndexprivate ImmutableMap<R,ImmutableMap<C,V>>rowMapprivate V[][]values
-
Constructor Summary
Constructors Constructor Description DenseImmutableTable(ImmutableList<Table.Cell<R,C,V>> cellList, ImmutableSet<R> rowSpace, ImmutableSet<C> columnSpace)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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) ImmutableTable.SerializedFormcreateSerializedForm()Creates the common serialized form for this table.Vget(java.lang.Object rowKey, java.lang.Object columnKey)Returns the value corresponding to the given row and column keys, ornullif no such mapping exists.(package private) Table.Cell<R,C,V>getCell(int index)(package private) VgetValue(int index)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.intsize()Returns the number of row key / column key / value mappings in the table.-
Methods inherited from class com.google.common.collect.RegularImmutableTable
checkNoDuplicate, createCellSet, createValues, forCells, forCells, forOrderedComponents
-
Methods inherited from class com.google.common.collect.ImmutableTable
builder, cellIterator, cellOf, cellSet, cellSpliterator, clear, column, columnKeySet, contains, containsValue, copyOf, 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, hashCode, isEmpty, toString, valuesSpliterator
-
-
-
-
Field Detail
-
rowKeyToIndex
private final ImmutableMap<R,java.lang.Integer> rowKeyToIndex
-
columnKeyToIndex
private final ImmutableMap<C,java.lang.Integer> columnKeyToIndex
-
rowMap
private final ImmutableMap<R,ImmutableMap<C,V>> rowMap
-
columnMap
private final ImmutableMap<C,ImmutableMap<R,V>> columnMap
-
rowCounts
private final int[] rowCounts
-
columnCounts
private final int[] columnCounts
-
values
private final V[][] values
-
cellRowIndices
private final int[] cellRowIndices
-
cellColumnIndices
private final int[] cellColumnIndices
-
-
Constructor Detail
-
DenseImmutableTable
DenseImmutableTable(ImmutableList<Table.Cell<R,C,V>> cellList, ImmutableSet<R> rowSpace, ImmutableSet<C> columnSpace)
-
-
Method Detail
-
columnMap
public ImmutableMap<C,java.util.Map<R,V>> columnMap()
Description copied from class:ImmutableTableReturns 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 areImmutableMapinstances as well.
-
rowMap
public ImmutableMap<R,java.util.Map<C,V>> rowMap()
Description copied from class:ImmutableTableReturns 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 areImmutableMapinstances as well.
-
get
public V get(java.lang.Object rowKey, java.lang.Object columnKey)
Description copied from interface:TableReturns the value corresponding to the given row and column keys, ornullif no such mapping exists.
-
size
public int size()
Description copied from interface:TableReturns the number of row key / column key / value mappings in the table.
-
getCell
Table.Cell<R,C,V> getCell(int index)
- Specified by:
getCellin classRegularImmutableTable<R,C,V>
-
createSerializedForm
ImmutableTable.SerializedForm createSerializedForm()
Description copied from class:ImmutableTableCreates the common serialized form for this table.- Specified by:
createSerializedFormin classImmutableTable<R,C,V>
-
-