Top Description Constructors Methods
com.google.common.collect

public abstract Class ForwardingTable<R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object>

extends ForwardingObject
implements Table<R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object>
Class Inheritance
All Implemented Interfaces
com.google.common.collect.Table
Known Direct Subclasses
com.google.common.collect.Tables.UnmodifiableTable
Annotations
@GwtCompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible, com.google.errorprone.annotations.CanIgnoreReturnValue, java.util.Collection, .Map, .Set, javax.annotation.CheckForNull, org.checkerframework.checker.nullness.qual.Nullable

A table which forwards all its method calls to another table. Subclasses should override one or more methods to modify the behavior of the backing map as desired per the decorator pattern.
Author
Gregory Kick
Since
7.0

Constructor Summary

AccessConstructor and Description
protected
ForwardingTable()

Constructor for use by subclasses.

Method Summary

Modifier and TypeMethod and Description
public Set<Table.Cell<R, C, V>>
cellSet()

Implements com.google.common.collect.Table.cellSet.

Returns a set of all row key / column key / value triplets.
public void
clear()

Implements com.google.common.collect.Table.clear.

Removes all mappings from the table.
public Map<R, V>
column(C
key of column to search for in the table
columnKey
)

Implements com.google.common.collect.Table.column.

Returns a view of all mappings that have the given column key.
public Set<C>
columnKeySet()

Implements com.google.common.collect.Table.columnKeySet.

Returns a set of column keys that have one or more values in the table.
public Map<C, Map<R, V>>
columnMap()

Implements com.google.common.collect.Table.columnMap.

Returns a view that associates each column key with the corresponding map from row keys to values.
public boolean
contains(Object
key of row to search for
rowKey
,
Object
key of column to search for
columnKey
)

Implements com.google.common.collect.Table.contains.

Returns true if the table contains a mapping with the specified row and column keys.
public boolean
containsColumn(Object
key of column to search for
columnKey
)

Implements com.google.common.collect.Table.containsColumn.

Returns true if the table contains a mapping with the specified column.
public boolean
containsRow(Object
key of row to search for
rowKey
)

Implements com.google.common.collect.Table.containsRow.

Returns true if the table contains a mapping with the specified row key.
public boolean
containsValue(Object
value to search for
value
)

Implements com.google.common.collect.Table.containsValue.

Returns true if the table contains a mapping with the specified value.
protected abstract Table<R, C, V>
delegate()

Implements abstract com.google.common.collect.ForwardingObject.delegate.

Returns the backing delegate instance that methods are forwarded to.
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Implements com.google.common.collect.Table.equals.

Compares the specified object with this table for equality.
public V
get(Object
key of row to search for
rowKey
,
Object
key of column to search for
columnKey
)

Implements com.google.common.collect.Table.get.

Returns the value corresponding to the given row and column keys, or null if no such mapping exists.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements com.google.common.collect.Table.hashCode.

Returns the hash code for this table.
public boolean
isEmpty()

Implements com.google.common.collect.Table.isEmpty.

Returns true if the table contains no mappings.
public 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
)

Implements com.google.common.collect.Table.put.

Associates the specified value with the specified keys.
public void
putAll(Table<? extends R, ? extends C, ? extends V>
the table to add to this table
table
)

Implements com.google.common.collect.Table.putAll.

Copies all mappings from the specified table to this table.
public V
remove(Object
row key of mapping to be removed
rowKey
,
Object
column key of mapping to be removed
columnKey
)

Implements com.google.common.collect.Table.remove.

Removes the mapping, if any, associated with the given keys.
public Map<C, V>
row(R
key of row to search for in the table
rowKey
)

Implements com.google.common.collect.Table.row.

Returns a view of all mappings that have the given row key.
public Set<R>
rowKeySet()

Implements com.google.common.collect.Table.rowKeySet.

Returns a set of row keys that have one or more values in the table.
public Map<R, Map<C, V>>
rowMap()

Implements com.google.common.collect.Table.rowMap.

Returns a view that associates each row key with the corresponding map from column keys to values.
public int
size()

Implements com.google.common.collect.Table.size.

Returns the number of row key / column key / value mappings in the table.
public Collection<V>
values()

Implements com.google.common.collect.Table.values.

Returns a collection of all values, which may contain duplicates.
Inherited from com.google.common.collect.ForwardingObject:
toString

Constructor Detail

ForwardingTableback to summary
protected ForwardingTable()

Constructor for use by subclasses.

Method Detail

cellSetback to summary
public Set<Table.Cell<R, C, V>> cellSet()

Implements com.google.common.collect.Table.cellSet.

Doc from com.google.common.collect.Table.cellSet.

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 add or addAll methods.

Returns:Set<Table.Cell<R, C, V>>

set of table cells consisting of row key / column key / value triplets

Annotations
@Override
clearback to summary
public void clear()

Implements com.google.common.collect.Table.clear.

Doc from com.google.common.collect.Table.clear.

Removes all mappings from the table.

Annotations
@Override
columnback to summary
public Map<R, V> column(C columnKey)

Implements com.google.common.collect.Table.column.

Doc from com.google.common.collect.Table.column.

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.

Parameters
columnKey:C

key of column to search for in the table

Returns:Map<R, V>

the corresponding map from row keys to values

Annotations
@Override
columnKeySetback to summary
public Set<C> columnKeySet()

Implements com.google.common.collect.Table.columnKeySet.

Doc from com.google.common.collect.Table.columnKeySet.

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.

Returns:Set<C>

set of column keys

Annotations
@Override
columnMapback to summary
public Map<C, Map<R, V>> columnMap()

Implements com.google.common.collect.Table.columnMap.

Doc from com.google.common.collect.Table.columnMap.

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 put() or putAll(), or setValue() on its entries.

In contrast, the maps returned by columnMap().get() have the same behavior as those returned by column. Those maps may support setValue(), put(), and putAll().

Returns:Map<C, Map<R, V>>

a map view from each column key to a secondary map from row keys to values

Annotations
@Override
containsback to summary
public boolean contains(Object rowKey, Object columnKey)

Implements com.google.common.collect.Table.contains.

Doc from com.google.common.collect.Table.contains.

Returns true if the table contains a mapping with the specified row and column keys.

Parameters
rowKey:Object

key of row to search for

columnKey:Object

key of column to search for

Annotations
@Override
containsColumnback to summary
public boolean containsColumn(Object columnKey)

Implements com.google.common.collect.Table.containsColumn.

Doc from com.google.common.collect.Table.containsColumn.

Returns true if the table contains a mapping with the specified column.

Parameters
columnKey:Object

key of column to search for

Annotations
@Override
containsRowback to summary
public boolean containsRow(Object rowKey)

Implements com.google.common.collect.Table.containsRow.

Doc from com.google.common.collect.Table.containsRow.

Returns true if the table contains a mapping with the specified row key.

Parameters
rowKey:Object

key of row to search for

Annotations
@Override
containsValueback to summary
public boolean containsValue(Object value)

Implements com.google.common.collect.Table.containsValue.

Doc from com.google.common.collect.Table.containsValue.

Returns true if the table contains a mapping with the specified value.

Parameters
value:Object

value to search for

Annotations
@Override
delegateback to summary
protected abstract Table<R, C, V> delegate()

Implements abstract com.google.common.collect.ForwardingObject.delegate.

Doc from com.google.common.collect.ForwardingObject.delegate.

Returns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such as ForwardingSet#delegate. Concrete subclasses override this method to supply the instance being decorated.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Implements com.google.common.collect.Table.equals.

Doc from com.google.common.collect.Table.equals.

Compares the specified object with this table for equality. Two tables are equal when their cell views, as returned by cellSet, are equal.

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getback to summary
public V get(Object rowKey, Object columnKey)

Implements com.google.common.collect.Table.get.

Doc from com.google.common.collect.Table.get.

Returns the value corresponding to the given row and column keys, or null if no such mapping exists.

Parameters
rowKey:Object

key of row to search for

columnKey:Object

key of column to search for

Annotations
@Override
@CheckForNull
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements com.google.common.collect.Table.hashCode.

Doc from com.google.common.collect.Table.hashCode.

Returns the hash code for this table. The hash code of a table is defined as the hash code of its cell view, as returned by cellSet.

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements com.google.common.collect.Table.isEmpty.

Doc from com.google.common.collect.Table.isEmpty.

Returns true if the table contains no mappings.

Annotations
@Override
putback to summary
public V put(R rowKey, C columnKey, V value)

Implements com.google.common.collect.Table.put.

Doc from com.google.common.collect.Table.put.

Associates the specified value with the specified keys. If the table already contained a mapping for those keys, the old value is replaced with the specified value.

Parameters
rowKey:R

row key that the value should be associated with

columnKey:C

column key that the value should be associated with

value:V

value to be associated with the specified keys

Returns:V

the value previously associated with the keys, or null if no mapping existed for the keys

Annotations
@CanIgnoreReturnValue
@Override
@CheckForNull
putAllback to summary
public void putAll(Table<? extends R, ? extends C, ? extends V> table)

Implements com.google.common.collect.Table.putAll.

Doc from com.google.common.collect.Table.putAll.

Copies all mappings from the specified table to this table. The effect is equivalent to calling put with each row key / column key / value mapping in table.

Parameters
table:Table<? extends R, ? extends C, ? extends V>

the table to add to this table

Annotations
@Override
removeback to summary
public V remove(Object rowKey, Object columnKey)

Implements com.google.common.collect.Table.remove.

Doc from com.google.common.collect.Table.remove.

Removes the mapping, if any, associated with the given keys.

Parameters
rowKey:Object

row key of mapping to be removed

columnKey:Object

column key of mapping to be removed

Returns:V

the value previously associated with the keys, or null if no such value existed

Annotations
@CanIgnoreReturnValue
@Override
@CheckForNull
rowback to summary
public Map<C, V> row(R rowKey)

Implements com.google.common.collect.Table.row.

Doc from com.google.common.collect.Table.row.

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.

Parameters
rowKey:R

key of row to search for in the table

Returns:Map<C, V>

the corresponding map from column keys to values

Annotations
@Override
rowKeySetback to summary
public Set<R> rowKeySet()

Implements com.google.common.collect.Table.rowKeySet.

Doc from com.google.common.collect.Table.rowKeySet.

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.

Returns:Set<R>

set of row keys

Annotations
@Override
rowMapback to summary
public Map<R, Map<C, V>> rowMap()

Implements com.google.common.collect.Table.rowMap.

Doc from com.google.common.collect.Table.rowMap.

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 put() or putAll(), or setValue() on its entries.

In contrast, the maps returned by rowMap().get() have the same behavior as those returned by row. Those maps may support setValue(), put(), and putAll().

Returns:Map<R, Map<C, V>>

a map view from each row key to a secondary map from column keys to values

Annotations
@Override
sizeback to summary
public int size()

Implements com.google.common.collect.Table.size.

Doc from com.google.common.collect.Table.size.

Returns the number of row key / column key / value mappings in the table.

Annotations
@Override
valuesback to summary
public Collection<V> values()

Implements com.google.common.collect.Table.values.

Doc from com.google.common.collect.Table.values.

Returns a collection of all values, which may contain duplicates. Changes to the returned collection will update the underlying table, and vice versa.

Returns:Collection<V>

collection of values

Annotations
@Override