Package net.hydromatic.morel.util
Class PairLists.ArrayImmutablePairList<T,U>
java.lang.Object
java.util.AbstractCollection<Map.Entry<T,U>>
java.util.AbstractList<Map.Entry<T,U>>
net.hydromatic.morel.util.PairLists.AbstractPairList<T,U>
net.hydromatic.morel.util.PairLists.ArrayImmutablePairList<T,U>
- Type Parameters:
T- First typeU- Second type
- All Implemented Interfaces:
Iterable<Map.Entry<T,,U>> Collection<Map.Entry<T,,U>> List<Map.Entry<T,,U>> SequencedCollection<Map.Entry<T,,U>> ImmutablePairList<T,,U> PairList<T,U>
- Enclosing class:
PairLists
static class PairLists.ArrayImmutablePairList<T,U>
extends PairLists.AbstractPairList<T,U>
implements ImmutablePairList<T,U>
Immutable list of pairs backed by an array.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.hydromatic.morel.util.PairList
PairList.Builder<T,U>, PairList.IndexedBiConsumer<T, U> -
Field Summary
FieldsFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionArrayImmutablePairList(Object[] elements) Creates an ArrayImmutablePairList. -
Method Summary
Modifier and TypeMethodDescriptionbooleanallMatch(BiPredicate<T, U> predicate) Returns whether the predicate is true for all pairs in this list.booleananyMatch(BiPredicate<T, U> predicate) Returns whether the predicate is true for at least one pair in this list.Returns a list containing the alternating left and right elements of each pair.voidforEach(BiConsumer<T, U> consumer) Calls a BiConsumer with each pair in this list.voidforEachIndexed(PairList.IndexedBiConsumer<T, U> consumer) Calls a BiConsumer with each pair in this list.get(int index) left(int index) Returns the left part of theindexth pair.leftList()Returns an unmodifiable list view consisting of the left entry of each pair.booleannoMatch(BiPredicate<T, U> predicate) Returns whether the predicate is true for no pairs in this list.right(int index) Returns the right part of theindexth pair.Returns an unmodifiable list view consisting of the right entry of each pair.intsize()<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.Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface net.hydromatic.morel.util.ImmutablePairList
immutableMethods inherited from interface java.util.List
add, add, addAll, addAll, addFirst, addLast, clear, contains, containsAll, equals, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, subList, toArray, toArray
-
Field Details
-
elements
-
-
Constructor Details
-
ArrayImmutablePairList
ArrayImmutablePairList(Object[] elements) Creates an ArrayImmutablePairList.Does not copy the
elementsarray. Assumes that the caller has made a copy, and will never modify the contents.Assumes that
elementsis not null, but checks that none of its elements are null.
-
-
Method Details
-
backingList
Description copied from class:PairLists.AbstractPairListReturns a list containing the alternating left and right elements of each pair.- Specified by:
backingListin classPairLists.AbstractPairList<T,U>
-
get
-
left
Description copied from interface:PairListReturns the left part of theindexth pair. -
right
Description copied from interface:PairListReturns the right part of theindexth pair. -
size
public int size() -
leftList
Description copied from interface:PairListReturns an unmodifiable list view consisting of the left entry of each pair. -
rightList
Description copied from interface:PairListReturns an unmodifiable list view consisting of the right entry of each pair. -
forEach
Description copied from interface:PairListCalls a BiConsumer with each pair in this list. -
forEachIndexed
Description copied from interface:PairListCalls a BiConsumer with each pair in this list.- Specified by:
forEachIndexedin interfacePairList<T,U>
-
transform
Description copied from interface:PairListApplies a mapping function to each element of this list. -
transform2
Description copied from interface:PairListApplies a mapping function to each element of this list.- Specified by:
transform2in interfacePairList<T,U>
-
anyMatch
Description copied from interface:PairListReturns whether the predicate is true for at least one pair in this list. -
allMatch
Description copied from interface:PairListReturns whether the predicate is true for all pairs in this list. -
noMatch
Description copied from interface:PairListReturns whether the predicate is true for no pairs in this list.
-