public final class TupleCollections extends Object
TupleList,
TupleIterator| Modifier and Type | Method and Description |
|---|---|
static Iterable<Member[]> |
asMemberArrayIterable(TupleIterable tupleIterable)
Converts a
TupleIterable to an old-style iterable that
creates an iterator over member arrays. |
static List<Member[]> |
asMemberArrayList(TupleList tupleList)
Converts a
TupleList to an old-style list of member
arrays. |
static TupleList |
asTupleList(List list)
Converts an old-style list (members or member arrays) to a
TupleList. |
static TupleList |
createList(int arity)
Creates a list of given arity.
|
static TupleList |
createList(int arity,
int initialCapacity)
Creates a list of given arity and initial capacity.
|
static TupleList |
emptyList(int arity)
Returns an empty TupleList of given arity.
|
static TupleIterator |
iterator(TupleCursor cursor)
Adapts a
TupleCursor into a TupleIterator. |
static TupleList |
materialize(TupleIterable tupleIterable,
boolean eager)
Converts a
TupleIterable into a TupleList. |
static Iterable<Member> |
slice(TupleIterable tupleIterable,
int column)
Creates a slice of a
TupleIterable. |
static TupleList |
unmodifiableList(TupleList list)
Creates an unmodifiable TupleList backed by a given list.
|
public static TupleList createList(int arity)
If arity == 1, creates a UnaryTupleList;
if arity == 0, creates a DelegatingTupleList;
otherwise creates a ArrayTupleList.
arity - ArityTupleList.cloneList(int),
createList(int, int)public static TupleList createList(int arity, int initialCapacity)
If arity == 1, creates a UnaryTupleList;
if arity == 0, creates a DelegatingTupleList;
otherwise creates a ArrayTupleList.
arity - ArityinitialCapacity - Initial capacityTupleList.cloneList(int)public static TupleList emptyList(int arity)
arity - Number of members per tuplepublic static TupleList unmodifiableList(TupleList list)
list - the list for which an unmodifiable view is to be returned.Collections.unmodifiableList(java.util.List)public static TupleIterator iterator(TupleCursor cursor)
TupleCursor into a TupleIterator.
Since the latter is a more difficult API to implement, the wrapper has some extra state.
This method may be used to implement
TupleIterable.tupleIterator() for a
TupleIterable or TupleList that only has a
TupleCursor implementation.
cursor - Cursorpublic static Iterable<Member> slice(TupleIterable tupleIterable, int column)
TupleIterable.
Can be used as an implementation for
TupleList.slice(int).
tupleIterable - Iterablecolumn - Which member of each tuple of project.public static Iterable<Member[]> asMemberArrayIterable(TupleIterable tupleIterable)
TupleIterable to an old-style iterable that
creates an iterator over member arrays.tupleIterable - Tuple iterablepublic static List<Member[]> asMemberArrayList(TupleList tupleList)
TupleList to an old-style list of member
arrays.tupleList - Tuple listpublic static TupleList asTupleList(List list)
TupleList.
Deduces the arity of the list from the first element, if the list is not empty. Otherwise assumes arity 1.
If the list happens to be a tuple list, returns unchanged.
list - Old-style listpublic static TupleList materialize(TupleIterable tupleIterable, boolean eager)
TupleIterable into a TupleList.
If the iterable is already a list, returns the iterable. If it is not
a list, the behavior depends on the eager parameter. With eager =
true, creates a list and populates it with the contents of the
iterable. With eager = false, wraps in an adapter that implements the
list interface and materializes to a list the first time that an
operation that is in TupleList but not TupleIterable -- for example,
TupleList.get(int, int) or List.size() -- is called.
tupleIterable - Iterableeager - Whether to convert into a list now, as opposed to on first
use of a random-access method such as size or get.Copyright © 2021 Hitachi Vantara. All rights reserved.