Package com.terracottatech.store
Class CellCollection.SubsetView
- All Implemented Interfaces:
CellCollection
,Iterable<Cell<?>>
,Collection<Cell<?>>
- Direct Known Subclasses:
KeyedCellCollection.SubsetView
- Enclosing interface:
- CellCollection
public static class CellCollection.SubsetView
extends AbstractCollection<Cell<?>>
implements CellCollection
A subset view of a cell collection.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.terracottatech.store.CellCollection
CellCollection.SubsetView
-
Field Summary
Fields inherited from interface com.terracottatech.store.CellCollection
CELLS_FIELD_NAME, DEPRECATED_CELLS_FIELD_NAME
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SubsetView
(CellCollection of, Set<CellDefinition<?>> definitions) Creates a subset view of the given collection showing only the given cells -
Method Summary
Modifier and TypeMethodDescriptionRetrieve a cell by name.protected Set<CellDefinition<?>>
The cell definitions this view selects.boolean
<T> Optional<T>
get
(CellDefinition<T> cellDefinition) Retrieve a cell byCellDefinition
.Optional<?>
Retrieve a cell by name.int
hashCode()
iterator()
int
size()
Spliterator<Cell<?>>
stream()
subset
(Set<CellDefinition<?>> definitions) Retrieve a subset of cells by their definitions.Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.terracottatech.store.CellCollection
asStoreMap, subset
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, toArray, toArray, toArray
-
Constructor Details
-
SubsetView
Creates a subset view of the given collection showing only the given cells- Parameters:
of
- the collection to viewdefinitions
- the cell definitions to select
-
-
Method Details
-
definitions
The cell definitions this view selects.- Returns:
- the selected cell definitions
-
subset
Description copied from interface:CellCollection
Retrieve a subset of cells by their definitions.The returned collection is a view. If this collection is mutable any mutations performed on this collection will be visible via the returned view.
- Specified by:
subset
in interfaceCellCollection
- Parameters:
definitions
- cells to retrieve- Returns:
- a view of a subset of this collection
-
get
Description copied from interface:CellCollection
Retrieve a cell byCellDefinition
. If this record contains a cell whose definition matches the supplied definition (in both name and type) then that cell's value is wrapped in anOptional
and returned. If this record contains no matching cell then an emptyOptional
is returned.- Specified by:
get
in interfaceCellCollection
- Type Parameters:
T
- the cell JDK type- Parameters:
cellDefinition
- cell to retrieve- Returns:
- An
Optional
with the cell value or an emptyOptional
if the record contains no matching cell
-
get
Description copied from interface:CellCollection
Retrieve a cell by name. If this record contains a cell whose definition matches the supplied name then that cell's value is wrapped in anOptional
and returned. If this record contains no matching cell then an emptyOptional
is returned.- Specified by:
get
in interfaceCellCollection
- Parameters:
name
- cell to retrieve- Returns:
- An
Optional
with the cell value or an emptyOptional
if the record contains no matching cell
-
cell
Description copied from interface:CellCollection
Retrieve a cell by name. If this record contains a cell whose definition matches the supplied name then the cell is wrapped in anOptional
and returned. If this record contains no matching cell then an emptyOptional
is returned.- Specified by:
cell
in interfaceCellCollection
- Parameters:
name
- cell to retrieve- Returns:
- An
Optional
with the cell or an emptyOptional
if the record contains no matching cell
-
spliterator
- Specified by:
spliterator
in interfaceCollection<Cell<?>>
- Specified by:
spliterator
in interfaceIterable<Cell<?>>
-
stream
- Specified by:
stream
in interfaceCollection<Cell<?>>
-
iterator
- Specified by:
iterator
in interfaceCollection<Cell<?>>
- Specified by:
iterator
in interfaceIterable<Cell<?>>
- Specified by:
iterator
in classAbstractCollection<Cell<?>>
-
size
public int size()- Specified by:
size
in interfaceCollection<Cell<?>>
- Specified by:
size
in classAbstractCollection<Cell<?>>
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<Cell<?>>
- Overrides:
hashCode
in classObject
-
equals
- Specified by:
equals
in interfaceCollection<Cell<?>>
- Overrides:
equals
in classObject
-