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

pack-priv Class StandardRowSortedTable<R, C, V>

extends StandardTable<R, C, V>
implements RowSortedTable<R, C, V>
Class Inheritance
All Implemented Interfaces
com.google.common.collect.RowSortedTable, com.google.common.collect.Table
Known Direct Subclasses
com.google.common.collect.TreeBasedTable
Annotations
@GwtCompatible
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull

Implementation of Table whose iteration ordering across row keys is sorted by their natural ordering or by a supplied comparator. Note that iterations across the columns keys for a single row key may or may not be ordered, depending on the implementation. When rows and columns are both sorted, it's easier to use the TreeBasedTable subclass.

The rowKeySet method returns a SortedSet and the rowMap method returns a SortedMap, instead of the Set and Map specified by the Table interface.

Null keys and values are not supported.

See the StandardTable superclass for more information about the behavior of this class.

Author
Jared Levy

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from com.google.common.collect.StandardTable:
backingMapfactory

Constructor Summary

AccessConstructor and Description
pack-priv
StandardRowSortedTable(SortedMap<R, Map<C, V>> backingMap, Supplier<? extends Map<C, V>> factory)

Method Summary

Modifier and TypeMethod and Description
pack-priv SortedMap<R, Map<C, V>>
public SortedSet<R>
public SortedMap<R, Map<C, V>>
rowMap()

Overrides com.google.common.collect.StandardTable.rowMap.

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

Returns a view that associates each row key with the corresponding map from column keys to values.
private SortedMap<R, Map<C, V>>
Inherited from com.google.common.collect.StandardTable:
cellIteratorcellSetcellSpliteratorclearcolumncolumnKeySetcolumnMapcontainscontainsColumncontainsRowcontainsValuecreateColumnKeyIteratorgetisEmptyputremoverowsizevalues

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.google.common.collect.StandardTable.serialVersionUID.

Constructor Detail

StandardRowSortedTableback to summary
pack-priv StandardRowSortedTable(SortedMap<R, Map<C, V>> backingMap, Supplier<? extends Map<C, V>> factory)

Method Detail

createRowMapback to summary
pack-priv SortedMap<R, Map<C, V>> createRowMap()

Overrides com.google.common.collect.StandardTable.createRowMap.

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

Overrides com.google.common.collect.StandardTable.rowKeySet.

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

Doc from com.google.common.collect.RowSortedTable.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.

This method returns a SortedSet, instead of the Set specified in the Table interface.

This method returns a SortedSet, instead of the Set specified in the Table interface.

Returns:SortedSet<R>

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

set of row keys

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

Overrides com.google.common.collect.StandardTable.rowMap.

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

Doc from com.google.common.collect.RowSortedTable.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().

This method returns a SortedMap, instead of the Map specified in the Table interface.

This method returns a SortedMap, instead of the Map specified in the Table interface.

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

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

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

Annotations
@Override
sortedBackingMapback to summary
private SortedMap<R, Map<C, V>> sortedBackingMap()
com.google.common.collect back to summary

private Class StandardRowSortedTable.RowSortedMap

extends StandardTable<R, C, V>.RowMap
implements SortedMap<R, Map<C, V>>
Class Inheritance
All Implemented Interfaces
java.util.SortedMap, java.util.SequencedMap, java.util.Map
Annotations
@WeakOuter

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Comparator<? super R>
comparator()

Implements java.util.SortedMap.comparator.

Returns the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys.
pack-priv SortedSet<R>
public R
firstKey()

Implements java.util.SortedMap.firstKey.

Returns the first (lowest) key currently in this map.
public SortedMap<R, Map<C, V>>
headMap(R
high endpoint (exclusive) of the keys in the returned map
toKey
)

Implements java.util.SortedMap.headMap.

Returns a view of the portion of this map whose keys are strictly less than toKey.
public SortedSet<R>
keySet()

Overrides com.google.common.collect.Maps.ViewCachingAbstractMap.keySet.

Implements java.util.SortedMap.keySet, java.util.Map.keySet.

Returns a Set view of the keys contained in this map.
public R
lastKey()

Implements java.util.SortedMap.lastKey.

Returns the last (highest) key currently in this map.
public SortedMap<R, Map<C, V>>
subMap(R
low endpoint (inclusive) of the keys in the returned map
fromKey
,
R
high endpoint (exclusive) of the keys in the returned map
toKey
)

Implements java.util.SortedMap.subMap.

Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.
public SortedMap<R, Map<C, V>>
tailMap(R
low endpoint (inclusive) of the keys in the returned map
fromKey
)

Implements java.util.SortedMap.tailMap.

Returns a view of the portion of this map whose keys are greater than or equal to fromKey.
Inherited from com.google.common.collect.StandardTable.RowMap:
containsKeycreateEntrySetgetremove

Constructor Detail

RowSortedMapback to summary
private RowSortedMap()

Method Detail

comparatorback to summary
public Comparator<? super R> comparator()

Implements java.util.SortedMap.comparator.

Doc from java.util.SortedMap.comparator.

Returns the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys.

Returns:Comparator<? super R>

the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys

Annotations
@Override
@CheckForNull
createKeySetback to summary
pack-priv SortedSet<R> createKeySet()

Overrides com.google.common.collect.Maps.ViewCachingAbstractMap.createKeySet.

Annotations
@Override
firstKeyback to summary
public R firstKey()

Implements java.util.SortedMap.firstKey.

Doc from java.util.SortedMap.firstKey.

Returns the first (lowest) key currently in this map.

Returns:R

the first (lowest) key currently in this map

Annotations
@Override
headMapback to summary
public SortedMap<R, Map<C, V>> headMap(R toKey)

Implements java.util.SortedMap.headMap.

Doc from java.util.SortedMap.headMap.

Returns a view of the portion of this map whose keys are strictly less than toKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Parameters
toKey:R

high endpoint (exclusive) of the keys in the returned map

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

a view of the portion of this map whose keys are strictly less than toKey

Annotations
@Override
keySetback to summary
public SortedSet<R> keySet()

Overrides com.google.common.collect.Maps.ViewCachingAbstractMap.keySet.

Implements java.util.SortedMap.keySet, java.util.Map.keySet.

Doc from java.util.SortedMap.keySet.

Returns a Set view of the keys contained in this map. The set's iterator returns the keys in ascending order. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.

Returns:SortedSet<R>

a set view of the keys contained in this map, sorted in ascending order

Annotations
@Override
lastKeyback to summary
public R lastKey()

Implements java.util.SortedMap.lastKey.

Doc from java.util.SortedMap.lastKey.

Returns the last (highest) key currently in this map.

Returns:R

the last (highest) key currently in this map

Annotations
@Override
subMapback to summary
public SortedMap<R, Map<C, V>> subMap(R fromKey, R toKey)

Implements java.util.SortedMap.subMap.

Doc from java.util.SortedMap.subMap.

Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive. (If fromKey and toKey are equal, the returned map is empty.) The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Parameters
fromKey:R

low endpoint (inclusive) of the keys in the returned map

toKey:R

high endpoint (exclusive) of the keys in the returned map

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

a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive

Annotations
@Override
tailMapback to summary
public SortedMap<R, Map<C, V>> tailMap(R fromKey)

Implements java.util.SortedMap.tailMap.

Doc from java.util.SortedMap.tailMap.

Returns a view of the portion of this map whose keys are greater than or equal to fromKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Parameters
fromKey:R

low endpoint (inclusive) of the keys in the returned map

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

a view of the portion of this map whose keys are greater than or equal to fromKey

Annotations
@Override