Package org.apache.calcite.runtime
Interface PairList<T,U>
- Type Parameters:
T
- First typeU
- Second type
- All Known Subinterfaces:
ImmutablePairList<T,
U>
A list of pairs, stored as a quotient list.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Builds a PairList.static class
Deprecated.static interface
Action to be taken each step of an indexed iteration over a PairList. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
Adds a pair to this list at a given position.default void
Adds a pair to this list.default boolean
Adds to this list, at a given index, the contents of another PairList.default boolean
Adds to this list the contents of another PairList.boolean
allMatch
(BiPredicate<T, U> predicate) Returns whether the predicate is true for all pairs in this list.boolean
anyMatch
(BiPredicate<T, U> predicate) Returns whether the predicate is true for at least one pair in this list.static <T,
U> PairList<T, U> Creates a PairList backed by a given list.static <T,
U> PairList.Builder<T, U> builder()
Creates a Builder.static <T,
U> PairList<T, U> Creates a PairList with one or more entries.void
forEach
(BiConsumer<T, U> consumer) Calls a BiConsumer with each pair in this list.void
forEachIndexed
(PairList.IndexedBiConsumer<T, U> consumer) Calls a BiConsumer with each pair in this list.Returns an ImmutablePairList whose contents are the same as this PairList.left
(int index) Returns the left part of theindex
th pair.leftList()
Returns an unmodifiable list view consisting of the left entry of each pair.boolean
noMatch
(BiPredicate<T, U> predicate) Returns whether the predicate is true for no pairs in this list.static <T,
U> PairList<T, U> of()
Creates an empty PairList.static <T,
U> PairList<T, U> Creates a PairList from a Map.static <T,
U> PairList<T, U> of
(T t, U u) Creates a singleton PairList.remove
(int index) default void
reverse()
Reverses the contents of this PairList.reversed()
Returns an immutable copy of this ImmutablePairList with the elements reversed.right
(int index) Returns the right part of theindex
th pair.Returns an unmodifiable list view consisting of the right entry of each pair.Sets the entry at positionindex
to the pair(t, u)
.subList
(int fromIndex, int toIndex) Creates anImmutableMap
whose entries are the pairs in this list.<R> List<R>
transform
(BiFunction<T, U, R> function) Applies a mapping function to each element of this list.<R> com.google.common.collect.ImmutableList<R>
transform2
(BiFunction<T, U, R> function) Applies a mapping function to each element of this list.static <T,
U> PairList<T, U> withCapacity
(int initialCapacity) Creates an empty PairList with a specified initial capacity.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, toArray, toArray
-
Method Details
-
of
Creates an empty PairList. -
of
Creates a singleton PairList. -
copyOf
Creates a PairList with one or more entries. -
withCapacity
Creates an empty PairList with a specified initial capacity. -
backedBy
Creates a PairList backed by a given list.Changes to the backing list will be reflected in the PairList. If the backing list is immutable, this PairList will be also.
-
of
Creates a PairList from a Map. -
builder
Creates a Builder. -
add
Adds a pair to this list. -
add
Adds a pair to this list at a given position. -
addAll
Adds to this list the contents of another PairList.Equivalent to
List.addAll(Collection)
, but more efficient. -
addAll
Adds to this list, at a given index, the contents of another PairList.Equivalent to
List.addAll(int, Collection)
, but more efficient. -
set
Sets the entry at positionindex
to the pair(t, u)
. -
remove
-
left
Returns the left part of theindex
th pair. -
right
Returns the right part of theindex
th pair. -
leftList
Returns an unmodifiable list view consisting of the left entry of each pair. -
rightList
Returns an unmodifiable list view consisting of the right entry of each pair. -
forEach
Calls a BiConsumer with each pair in this list. -
forEachIndexed
Calls a BiConsumer with each pair in this list. -
toImmutableMap
Creates anImmutableMap
whose entries are the pairs in this list. Throws if keys are not unique. -
immutable
ImmutablePairList<T,U> immutable()Returns an ImmutablePairList whose contents are the same as this PairList. -
transform
Applies a mapping function to each element of this list. -
transform2
Applies a mapping function to each element of this list. -
subList
-
anyMatch
Returns whether the predicate is true for at least one pair in this list. -
allMatch
Returns whether the predicate is true for all pairs in this list. -
noMatch
Returns whether the predicate is true for no pairs in this list. -
reverse
default void reverse()Reverses the contents of this PairList. Throws if this PairList is immutable.- See Also:
-
reversed
ImmutablePairList<T,U> reversed()Returns an immutable copy of this ImmutablePairList with the elements reversed.Throws
NullPointerException
if any keys or values are null.
-