Table whose contents will never change, with many other important properties detailed
at ImmutableCollection.
See the Guava User Guide article on immutable collections.
| Modifier and Type | Class and Description |
|---|---|
| public static class | ImmutableTable.Builder<R, C, V>
A builder for creating immutable table instances, especially |
| pack-priv static class | ImmutableTable.SerializedForm
Serialized type for all ImmutableTable instances. |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public static <R, C, V> ImmutableTable. | |
| pack-priv final UnmodifiableIterator | |
| pack-priv static <R, C, V> Table. | cellOf(R rowKey, C columnKey, V value)
Verifies that |
| public ImmutableSet | cellSet()
Overrides com. Implements com. |
| pack-priv final Spliterator | |
| public final void | clear()
Overrides com. Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the table unmodified.
|
| public ImmutableMap | column(C
key of column to search for in the table columnKey)Implements com. |
| public ImmutableSet | columnKeySet()
Overrides com. Implements com. |
| public abstract ImmutableMap | columnMap()
Redeclares com. |
| public boolean | contains(Object
key of row to search for rowKey, Object key of column to search for columnKey)Overrides com. Implements com. true if the table contains a mapping with the specified row and column keys.
|
| public boolean | containsValue(Object
value to search for value)Overrides com. Implements com. true if the table contains a mapping with the specified value.
|
| public static <R, C, V> ImmutableTable | |
| pack-priv static <R, C, V> ImmutableTable | |
| pack-priv abstract ImmutableSet | |
| pack-priv abstract ImmutableTable. | |
| pack-priv abstract ImmutableCollection | |
| public static <R, C, V> ImmutableTable | |
| public static <R, C, V> ImmutableTable | |
| public final V | put(R
row key that the value should be associated with rowKey, C column key that the value should be associated with columnKey, V value to be associated with the specified keys value)Overrides com. Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the table unmodified.
|
| public final void | putAll(Table<? extends R, ? extends C, ? extends V>
the table to add to this table table)Overrides com. Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the table unmodified.
|
| private void | |
| public final V | remove(Object
row key of mapping to be removed rowKey, Object column key of mapping to be removed columnKey)Overrides com. Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the table unmodified.
|
| public ImmutableMap | row(R
key of row to search for in the table rowKey)Implements com. |
| public ImmutableSet | rowKeySet()
Overrides com. Implements com. |
| public abstract ImmutableMap | rowMap()
Redeclares com. |
| public static <T extends @Nullable Object, R, C, V> Collector | toImmutableTable(Function<? super T, ? extends R> rowFunction, Function<? super T, ? extends C> columnFunction, Function<? super T, ? extends V> valueFunction)
Returns a |
| public static <T extends @Nullable Object, R, C, V> Collector | toImmutableTable(Function<? super T, ? extends R> rowFunction, Function<? super T, ? extends C> columnFunction, Function<? super T, ? extends V> valueFunction, BinaryOperator<V> mergeFunction)
Returns a |
| public ImmutableCollection | values()
Overrides com. Implements com. |
| pack-priv final Iterator | |
| pack-priv final Object |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| ImmutableTable | back to summary |
|---|---|
| pack-priv ImmutableTable() | |
| builder | back to summary |
|---|---|
| public static <R, C, V> ImmutableTable. Returns a new builder. The generated builder is equivalent to the builder created by the | |
| cellIterator | back to summary |
|---|---|
| pack-priv final UnmodifiableIterator Implements abstract com.
| |
| cellOf | back to summary |
|---|---|
| pack-priv static <R, C, V> Table. Verifies that | |
| cellSet | back to summary |
|---|---|
| public ImmutableSet Overrides com. Implements com. Doc from com. Returns a set of all row key / column key / value triplets. Changes to the returned set will
update the underlying table, and vice versa. The cell set does not support the
| |
| cellSpliterator | back to summary |
|---|---|
| pack-priv final Spliterator Implements abstract com.
| |
| clear | back to summary |
|---|---|
| public final void clear() Overrides com. Implements com. Deprecated Unsupported operation. Guaranteed to throw an exception and leave the table unmodified.
| |
| column | back to summary |
|---|---|
| public ImmutableMap Implements com. Doc from com. 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.
| |
| columnKeySet | back to summary |
|---|---|
| public ImmutableSet Overrides com. Implements com. Doc from com. Returns a set of column keys that have one or more values in the table. Changes to the set will update the underlying table, and vice versa.
| |
| columnMap | back to summary |
|---|---|
| public abstract ImmutableMap Redeclares com. Doc from com. 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 support
In contrast, the maps returned by The value
| |
| contains | back to summary |
|---|---|
| public boolean contains(Object rowKey, Object columnKey) Overrides com. Implements com. Doc from com. Returns | |
| containsValue | back to summary |
|---|---|
| public boolean containsValue(Object value) Overrides com. Implements com. Doc from com. Returns | |
| copyOf | back to summary |
|---|---|
| public static <R, C, V> ImmutableTable Returns an immutable copy of the provided table. The Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change. | |
| copyOf | back to summary |
|---|---|
| pack-priv static <R, C, V> ImmutableTable | |
| createCellSet | back to summary |
|---|---|
| pack-priv abstract ImmutableSet Overrides com.
| |
| createSerializedForm | back to summary |
|---|---|
| pack-priv abstract ImmutableTable. Creates the common serialized form for this table. | |
| createValues | back to summary |
|---|---|
| pack-priv abstract ImmutableCollection Overrides com.
| |
| of | back to summary |
|---|---|
| public static <R, C, V> ImmutableTable Returns an empty immutable table. Performance note: the instance returned is a singleton.
| |
| of | back to summary |
|---|---|
| public static <R, C, V> ImmutableTable Returns an immutable table containing a single cell. | |
| put | back to summary |
|---|---|
| public final V put(R rowKey, C columnKey, V value) Overrides com. Implements com. Deprecated Unsupported operation. Guaranteed to throw an exception and leave the table unmodified.
| |
| putAll | back to summary |
|---|---|
| public final void putAll(Table<? extends R, ? extends C, ? extends V> table) Overrides com. Implements com. Deprecated Unsupported operation. Guaranteed to throw an exception and leave the table unmodified.
| |
| readObject | back to summary |
|---|---|
private void readObject(ObjectInputStream stream) throws InvalidObjectException
| |
| remove | back to summary |
|---|---|
| public final V remove(Object rowKey, Object columnKey) Overrides com. Implements com. Deprecated Unsupported operation. Guaranteed to throw an exception and leave the table unmodified.
| |
| row | back to summary |
|---|---|
| public ImmutableMap Implements com. Doc from com. Returns a view of all mappings that have the given row key. For each row key / column key / value mapping in the table with that row key, the returned map associates the column key with the value. If no mappings in the table have the provided row key, an empty map is returned. Changes to the returned map will update the underlying table, and vice versa.
| |
| rowKeySet | back to summary |
|---|---|
| public ImmutableSet Overrides com. Implements com. Doc from com. Returns a set of row keys that have one or more values in the table. Changes to the set will update the underlying table, and vice versa.
| |
| rowMap | back to summary |
|---|---|
| public abstract ImmutableMap Redeclares com. Doc from com. 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 support
In contrast, the maps returned by The value
| |
| toImmutableTable | back to summary |
|---|---|
| public static <T extends @Nullable Object, R, C, V> Collector Returns a The returned
| |
| toImmutableTable | back to summary |
|---|---|
| public static <T extends @Nullable Object, R, C, V> Collector Returns a The returned
| |
| values | back to summary |
|---|---|
| public ImmutableCollection Overrides com. Implements com. Doc from com. Returns a collection of all values, which may contain duplicates. Changes to the returned collection will update the underlying table, and vice versa.
| |
| valuesIterator | back to summary |
|---|---|
| pack-priv final Iterator Overrides com.
| |
| writeReplace | back to summary |
|---|---|
| pack-priv final Object writeReplace() | |
public static final tables
("constant tables"). Example:
static final ImmutableTable<Integer, Character, String> SPREADSHEET =
new ImmutableTable.Builder<Integer, Character, String>()
.put(1, 'A', "foo")
.put(1, 'B', "bar")
.put(2, 'A', "baz")
.buildOrThrow();
By default, the order in which cells are added to the builder determines the iteration
ordering of all views in the returned table, with putAll following the Table#cellSet() iteration order. However, if orderRowsBy or orderColumnsBy
is called, the views are sorted by the supplied comparators.
For empty or single-cell immutable tables, of() and of(Object, Object,
Object) are even more convenient.
Builder instances can be reused - it is safe to call buildOrThrow multiple times to
build multiple tables in series. Each table is a superset of the tables created before it.
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private Comparator | |
| private Comparator |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ImmutableTable | |
| public ImmutableTable | buildOrThrow()
Returns a newly-created immutable table, or throws an exception if duplicate key pairs were added. |
| pack-priv ImmutableTable. | |
| public ImmutableTable. | orderColumnsBy(Comparator<? super C> columnComparator)
Specifies the ordering of the generated table's columns. |
| public ImmutableTable. | orderRowsBy(Comparator<? super R> rowComparator)
Specifies the ordering of the generated table's rows. |
| public ImmutableTable. | put(R rowKey, C columnKey, V value)
Associates the ( |
| public ImmutableTable. | |
| public ImmutableTable. |
| cells | back to summary |
|---|---|
| private final List<Table. | |
| columnComparator | back to summary |
|---|---|
| private Comparator<? super C> columnComparator
| |
| rowComparator | back to summary |
|---|---|
| private Comparator<? super R> rowComparator
| |
| Builder | back to summary |
|---|---|
| public Builder() Creates a new builder. The returned builder is equivalent to the builder generated by | |
| build | back to summary |
|---|---|
| public ImmutableTable Returns a newly-created immutable table. Prefer the equivalent method
| |
| buildOrThrow | back to summary |
|---|---|
| public ImmutableTable Returns a newly-created immutable table, or throws an exception if duplicate key pairs were added.
| |
| combine | back to summary |
|---|---|
pack-priv ImmutableTable.
| |
| orderColumnsBy | back to summary |
|---|---|
| public ImmutableTable. Specifies the ordering of the generated table's columns.
| |
| orderRowsBy | back to summary |
|---|---|
| public ImmutableTable. Specifies the ordering of the generated table's rows.
| |
| put | back to summary |
|---|---|
| public ImmutableTable. Associates the (
| |
| put | back to summary |
|---|---|
| public ImmutableTable. Adds the given
| |
| putAll | back to summary |
|---|---|
| public ImmutableTable. Associates all of the given table's keys and values in the built table. Duplicate row key
column key pairs are not allowed, and will cause
| |
| Modifier and Type | Field and Description |
|---|---|
| private final int[] | |
| private final int[] | |
| private final Object[] | |
| private final Object[] | |
| private final Object[] | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| private | SerializedForm(Object[] rowKeys, Object[] columnKeys, Object[] cellValues, int[] cellRowIndices, int[] cellColumnIndices)
|
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static ImmutableTable. | |
| pack-priv Object |
| cellColumnIndices | back to summary |
|---|---|
| private final int[] cellColumnIndices | |
| cellRowIndices | back to summary |
|---|---|
| private final int[] cellRowIndices | |
| cellValues | back to summary |
|---|---|
| private final Object[] cellValues | |
| columnKeys | back to summary |
|---|---|
| private final Object[] columnKeys | |
| rowKeys | back to summary |
|---|---|
| private final Object[] rowKeys | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| SerializedForm | back to summary |
|---|---|
| private SerializedForm(Object[] rowKeys, Object[] columnKeys, Object[] cellValues, int[] cellRowIndices, int[] cellColumnIndices) | |
| create | back to summary |
|---|---|
| pack-priv static ImmutableTable. | |
| readResolve | back to summary |
|---|---|
| pack-priv Object readResolve() | |