Top Description Inners Fields Constructors Methods
com.google.common.collect

pack-priv abstract Class AbstractTable<R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object>

extends Object
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.ArrayTable, com.google.common.collect.StandardTable, com.google.common.collect.ImmutableTable, com.google.common.collect.Tables.TransposeTable, com.google.common.collect.Tables.TransformedTable
Annotations
@GwtCompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible, com.google.errorprone.annotations.CanIgnoreReturnValue, com.google.errorprone.annotations.concurrent.LazyInit, com.google.j2objc.annotations.WeakOuter, java.util.AbstractCollection, .AbstractSet, .Collection, .Iterator, .Map, .Set, .Spliterator, javax.annotation.CheckForNull, org.checkerframework.checker.nullness.qual.Nullable

Skeletal, implementation-agnostic implementation of the Table interface.
Author
Louis Wasserman

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
pack-priv class

Field Summary

Modifier and TypeField and Description
private transient Set<Table.Cell<R, C, V>>
private transient Collection<V>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract Iterator<Table.Cell<R, C, V>>
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.
pack-priv abstract Spliterator<Table.Cell<R, C, V>>
public void
clear()

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

Removes all mappings from the table.
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 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.
pack-priv Set<Table.Cell<R, C, V>>
pack-priv Collection<V>
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 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 String
toString()

Overrides java.lang.Object.toString.

Returns the string representation rowMap().toString().
public Collection<V>
values()

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

Returns a collection of all values, which may contain duplicates.
pack-priv Iterator<V>
pack-priv Spliterator<V>
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

cellSetback to summary
private transient Set<Table.Cell<R, C, V>> cellSet
Annotations
@LazyInit
@CheckForNull
valuesback to summary
private transient Collection<V> values
Annotations
@LazyInit
@CheckForNull

Constructor Detail

AbstractTableback to summary
pack-priv AbstractTable()

Method Detail

cellIteratorback to summary
pack-priv abstract Iterator<Table.Cell<R, C, V>> cellIterator()
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
cellSpliteratorback to summary
pack-priv abstract Spliterator<Table.Cell<R, C, V>> cellSpliterator()
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
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
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
createCellSetback to summary
pack-priv Set<Table.Cell<R, C, V>> createCellSet()
createValuesback to summary
pack-priv Collection<V> createValues()
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
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
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns the string representation rowMap().toString().

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

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
valuesIteratorback to summary
pack-priv Iterator<V> valuesIterator()
valuesSpliteratorback to summary
pack-priv Spliterator<V> valuesSpliterator()
com.google.common.collect back to summary

pack-priv Class AbstractTable.CellSet

extends AbstractSet<Table.Cell<R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object>>
Class Inheritance
Annotations
@WeakOuter

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Removes all of the elements from this set (optional operation).
public boolean
contains(Object
element whose presence in this set is to be tested
o
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this set contains the specified element.
public Iterator<Table.Cell<R, C, V>>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.
public boolean
remove(Object
object to be removed from this set, if present
o
)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Removes the specified element from this set if it is present (optional operation).
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).
public Spliterator<Table.Cell<R, C, V>>
spliterator()

Overrides default java.util.Set.spliterator, java.util.Collection.spliterator.

Creates a Spliterator over the elements in this set.
Inherited from java.util.AbstractSet:
equalshashCoderemoveAll

Constructor Detail

CellSetback to summary
pack-priv CellSet()

Method Detail

clearback to summary
public void clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Doc from java.util.Set.clear.

Removes all of the elements from this set (optional operation). The set will be empty after this call returns.

Annotations
@Override
containsback to summary
public boolean contains(Object o)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Doc from java.util.Set.contains.

Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(o, e).

Parameters
o:Object

element whose presence in this set is to be tested

Returns:boolean

true if this set contains the specified element

Annotations
@Override
iteratorback to summary
public Iterator<Table.Cell<R, C, V>> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

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

an iterator over the elements in this set

Annotations
@Override
removeback to summary
public boolean remove(Object o)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Doc from java.util.Set.remove.

Removes the specified element from this set if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this set contains such an element. Returns true if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)

Parameters
o:Object

object to be removed from this set, if present

Returns:boolean

true if this set contained the specified element

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)

Annotations
@Override
spliteratorback to summary
public Spliterator<Table.Cell<R, C, V>> spliterator()

Overrides default java.util.Set.spliterator, java.util.Collection.spliterator.

Doc from java.util.Set.spliterator.

Creates a Spliterator over the elements in this set.

The Spliterator reports Spliterator#DISTINCT. Implementations should document the reporting of additional characteristic values.

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

a Spliterator over the elements in this set

Annotations
@Override
com.google.common.collect back to summary

pack-priv Class AbstractTable.Values

extends AbstractCollection<V extends @Nullable Object>
Class Inheritance
Annotations
@WeakOuter

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Collection.clear.

Removes all of the elements from this collection (optional operation).
public boolean
contains(Object
element whose presence in this collection is to be tested
o
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Collection.contains.

Returns true if this collection contains the specified element.
public Iterator<V>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Returns an iterator over the elements contained in this collection.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Returns the number of elements in this collection.
public Spliterator<V>
spliterator()

Overrides default java.util.Collection.spliterator.

Creates a Spliterator over the elements in this collection.
Inherited from java.util.AbstractCollection:
addaddAllcontainsAllisEmptyremoveremoveAllretainAlltoArraytoArraytoString

Constructor Detail

Valuesback to summary
pack-priv Values()

Method Detail

clearback to summary
public void clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Collection.clear.

Doc from java.util.AbstractCollection.clear.

Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.

Annotations
@Override
containsback to summary
public boolean contains(Object o)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Collection.contains.

Doc from java.util.AbstractCollection.contains.

Returns true if this collection contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that Objects.equals(o, e).

Parameters
o:Object

Doc from java.util.Collection.contains.

element whose presence in this collection is to be tested

Returns:boolean

Doc from java.util.Collection.contains.

true if this collection contains the specified element

Annotations
@Override
iteratorback to summary
public Iterator<V> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Doc from java.util.AbstractCollection.iterator.

Returns an iterator over the elements contained in this collection.

Returns:Iterator<V>

an iterator over the elements contained in this collection

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Doc from java.util.Collection.size.

Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this collection

Annotations
@Override
spliteratorback to summary
public Spliterator<V> spliterator()

Overrides default java.util.Collection.spliterator.

Doc from java.util.Collection.spliterator.

Creates a Spliterator over the elements in this collection. Implementations should document characteristic values reported by the spliterator. Such characteristic values are not required to be reported if the spliterator reports Spliterator#SIZED and this collection contains no elements.

The default implementation should be overridden by subclasses that can return a more efficient spliterator. In order to preserve expected laziness behavior for the stream() and parallelStream() methods, spliterators should either have the characteristic of IMMUTABLE or CONCURRENT, or be late-binding. If none of these is practical, the overriding class should describe the spliterator's documented policy of binding and structural interference, and should override the stream() and parallelStream() methods to create streams using a Supplier of the spliterator, as in:

Stream<E> s = StreamSupport.stream(() -> spliterator(), spliteratorCharacteristics)

These requirements ensure that streams produced by the stream() and parallelStream() methods will reflect the contents of the collection as of initiation of the terminal stream operation.

Returns:Spliterator<V>

a Spliterator over the elements in this collection

Annotations
@Override