Package com.google.common.collect
Class AbstractTable<R,C,V>
- java.lang.Object
-
- com.google.common.collect.AbstractTable<R,C,V>
-
- All Implemented Interfaces:
Table<R,C,V>
- Direct Known Subclasses:
ArrayTable,ImmutableTable,StandardTable,Tables.TransformedTable,Tables.TransposeTable
abstract class AbstractTable<R,C,V> extends java.lang.Object implements Table<R,C,V>
Skeletal, implementation-agnostic implementation of theTableinterface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classAbstractTable.CellSet(package private) classAbstractTable.Values-
Nested classes/interfaces inherited from interface com.google.common.collect.Table
Table.Cell<R,C,V>
-
-
Constructor Summary
Constructors Constructor Description AbstractTable()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract java.util.Iterator<Table.Cell<R,C,V>>cellIterator()java.util.Set<Table.Cell<R,C,V>>cellSet()Returns a set of all row key / column key / value triplets.(package private) abstract java.util.Spliterator<Table.Cell<R,C,V>>cellSpliterator()voidclear()Removes all mappings from the table.java.util.Set<C>columnKeySet()Returns a set of column keys that have one or more values in the table.booleancontains(java.lang.Object rowKey, java.lang.Object columnKey)Returnstrueif the table contains a mapping with the specified row and column keys.booleancontainsColumn(java.lang.Object columnKey)Returnstrueif the table contains a mapping with the specified column.booleancontainsRow(java.lang.Object rowKey)Returnstrueif the table contains a mapping with the specified row key.booleancontainsValue(java.lang.Object value)Returnstrueif the table contains a mapping with the specified value.(package private) java.util.Set<Table.Cell<R,C,V>>createCellSet()(package private) java.util.Collection<V>createValues()booleanequals(java.lang.Object obj)Compares the specified object with this table for equality.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.inthashCode()Returns the hash code for this table.booleanisEmpty()Returnstrueif the table contains no mappings.Vput(R rowKey, C columnKey, V value)Associates the specified value with the specified keys.voidputAll(Table<? extends R,? extends C,? extends V> table)Copies all mappings from the specified table to this table.Vremove(java.lang.Object rowKey, java.lang.Object columnKey)Removes the mapping, if any, associated with the given keys.java.util.Set<R>rowKeySet()Returns a set of row keys that have one or more values in the table.java.lang.StringtoString()Returns the string representationrowMap().toString().java.util.Collection<V>values()Returns a collection of all values, which may contain duplicates.(package private) java.util.Iterator<V>valuesIterator()(package private) java.util.Spliterator<V>valuesSpliterator()
-
-
-
Field Detail
-
cellSet
private transient java.util.Set<Table.Cell<R,C,V>> cellSet
-
values
private transient java.util.Collection<V> values
-
-
Method Detail
-
containsRow
public boolean containsRow(java.lang.Object rowKey)
Description copied from interface:TableReturnstrueif the table contains a mapping with the specified row key.- Specified by:
containsRowin interfaceTable<R,C,V>- Parameters:
rowKey- key of row to search for
-
containsColumn
public boolean containsColumn(java.lang.Object columnKey)
Description copied from interface:TableReturnstrueif the table contains a mapping with the specified column.- Specified by:
containsColumnin interfaceTable<R,C,V>- Parameters:
columnKey- key of column to search for
-
rowKeySet
public java.util.Set<R> rowKeySet()
Description copied from interface:TableReturns 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.
-
columnKeySet
public java.util.Set<C> columnKeySet()
Description copied from interface:TableReturns 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.- Specified by:
columnKeySetin interfaceTable<R,C,V>- Returns:
- set of column keys
-
containsValue
public boolean containsValue(java.lang.Object value)
Description copied from interface:TableReturnstrueif the table contains a mapping with the specified value.- Specified by:
containsValuein interfaceTable<R,C,V>- Parameters:
value- value to search for
-
contains
public boolean contains(java.lang.Object rowKey, java.lang.Object columnKey)Description copied from interface:TableReturnstrueif the table contains a mapping with the specified row and column keys.
-
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.
-
isEmpty
public boolean isEmpty()
Description copied from interface:TableReturnstrueif the table contains no mappings.
-
clear
public void clear()
Description copied from interface:TableRemoves all mappings from the table.
-
remove
public V remove(java.lang.Object rowKey, java.lang.Object columnKey)
Description copied from interface:TableRemoves the mapping, if any, associated with the given keys.
-
put
public V put(R rowKey, C columnKey, V value)
Description copied from interface:TableAssociates 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.- Specified by:
putin interfaceTable<R,C,V>- Parameters:
rowKey- row key that the value should be associated withcolumnKey- column key that the value should be associated withvalue- value to be associated with the specified keys- Returns:
- the value previously associated with the keys, or
nullif no mapping existed for the keys
-
putAll
public void putAll(Table<? extends R,? extends C,? extends V> table)
Description copied from interface:TableCopies all mappings from the specified table to this table. The effect is equivalent to callingTable.put(R, C, V)with each row key / column key / value mapping intable.
-
cellSet
public java.util.Set<Table.Cell<R,C,V>> cellSet()
Description copied from interface:TableReturns 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 theaddoraddAllmethods.
-
createCellSet
java.util.Set<Table.Cell<R,C,V>> createCellSet()
-
cellIterator
abstract java.util.Iterator<Table.Cell<R,C,V>> cellIterator()
-
cellSpliterator
abstract java.util.Spliterator<Table.Cell<R,C,V>> cellSpliterator()
-
values
public java.util.Collection<V> values()
Description copied from interface:TableReturns a collection of all values, which may contain duplicates. Changes to the returned collection will update the underlying table, and vice versa.
-
createValues
java.util.Collection<V> createValues()
-
valuesIterator
java.util.Iterator<V> valuesIterator()
-
valuesSpliterator
java.util.Spliterator<V> valuesSpliterator()
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:TableCompares the specified object with this table for equality. Two tables are equal when their cell views, as returned byTable.cellSet(), are equal.
-
hashCode
public int hashCode()
Description copied from interface:TableReturns the hash code for this table. The hash code of a table is defined as the hash code of its cell view, as returned byTable.cellSet().
-
toString
public java.lang.String toString()
Returns the string representationrowMap().toString().- Overrides:
toStringin classjava.lang.Object
-
-