Package extra166y
Class ParallelArrayWithFilter<T>
java.lang.Object
extra166y.AbstractParallelAnyArray
extra166y.ParallelArrayWithMapping<T,T>
extra166y.ParallelArrayWithFilter<T>
- Direct Known Subclasses:
ParallelArrayWithBounds
A prefix view of ParallelArray that causes operations to apply
only to elements for which a selector returns true.
Instances of this class may be constructed only via prefix
methods of ParallelArray or its other prefix classes.
-
Method Summary
Modifier and TypeMethodDescriptionReturns a new ParallelArray containing only non-null unique elements (that is, without any duplicates).Returns a new ParallelArray containing only non-null unique elements (that is, without any duplicates).<U,
V> boolean hasAllEqualElements
(ParallelArrayWithMapping<U, V> other) Returns true if all elements at the same relative positions of this and other array are equal.<U,
V> boolean hasAllIdenticalElements
(ParallelArrayWithMapping<U, V> other) Returns true if all elements at the same relative positions of this and other array are identical.replaceWithGeneratedValue
(Ops.Generator<? extends T> generator) Replaces elements with results of applying the given generator.replaceWithMappedIndex
(Ops.IntAndObjectToObject<? super T, ? extends T> op) Replaces elements with the results of applying the given mapping to each index and current element valuereplaceWithMappedIndex
(Ops.IntToObject<? extends T> op) Replaces elements with the results of applying the given op to their indices<V,
W> ParallelArrayWithFilter<T> replaceWithMapping
(Ops.BinaryOp<? super T, ? super V, ? extends T> combiner, ParallelArrayWithMapping<W, V> other) Replaces elements with results of applying op(thisElement, otherElement)replaceWithMapping
(Ops.BinaryOp<T, T, T> combiner, T[] other) Replaces elements with results of applying op(thisElement, otherElement)replaceWithMapping
(Ops.Op<? super T, ? extends T> op) Replaces elements with the results of applying the given op to their current values.replaceWithValue
(T value) Replaces elements with the given value.<V,
W> ParallelArrayWithFilter<T> withFilter
(Ops.BinaryPredicate<? super T, ? super V> selector, ParallelArrayWithMapping<W, V> other) Returns an operation prefix that causes a method to operate only on elements for which the current selector (if present) and the given binary selector returns trueabstract ParallelArrayWithFilter<T>
withFilter
(Ops.Predicate<? super T> selector) Returns an operation prefix that causes a method to operate only on elements for which the current selector (if present) and the given selector returns trueabstract ParallelArrayWithFilter<T>
withIndexedFilter
(Ops.IntAndObjectPredicate<? super T> selector) Returns an operation prefix that causes a method to operate only on elements for which the current selector (if present) and the given indexed selector returns trueMethods inherited from class extra166y.ParallelArrayWithMapping
all, all, any, apply, max, max, min, min, reduce, sequentially, summary, summary, withIndexedMapping, withIndexedMapping, withIndexedMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping
Methods inherited from class extra166y.AbstractParallelAnyArray
anyIndex, isEmpty, size
-
Method Details
-
replaceWithMapping
Replaces elements with the results of applying the given op to their current values.- Parameters:
op
- the op- Returns:
- this (to simplify use in expressions)
-
replaceWithMappedIndex
Replaces elements with the results of applying the given op to their indices- Parameters:
op
- the op- Returns:
- this (to simplify use in expressions)
-
replaceWithMappedIndex
public ParallelArrayWithFilter<T> replaceWithMappedIndex(Ops.IntAndObjectToObject<? super T, ? extends T> op) Replaces elements with the results of applying the given mapping to each index and current element value- Parameters:
op
- the op- Returns:
- this (to simplify use in expressions)
-
replaceWithGeneratedValue
Replaces elements with results of applying the given generator.- Parameters:
generator
- the generator- Returns:
- this (to simplify use in expressions)
-
replaceWithValue
Replaces elements with the given value.- Parameters:
value
- the value- Returns:
- this (to simplify use in expressions)
-
replaceWithMapping
public <V,W> ParallelArrayWithFilter<T> replaceWithMapping(Ops.BinaryOp<? super T, ? super V, ? extends T> combiner, ParallelArrayWithMapping<W, V> other) Replaces elements with results of applying op(thisElement, otherElement)- Parameters:
other
- the other arraycombiner
- the combiner- Returns:
- this (to simplify use in expressions)
-
replaceWithMapping
Replaces elements with results of applying op(thisElement, otherElement)- Parameters:
other
- the other arraycombiner
- the combiner- Returns:
- this (to simplify use in expressions)
-
allUniqueElements
Returns a new ParallelArray containing only non-null unique elements (that is, without any duplicates). This method uses each element's equals method to test for duplication.- Returns:
- the new ParallelArray
-
allNonidenticalElements
Returns a new ParallelArray containing only non-null unique elements (that is, without any duplicates). This method uses reference identity to test for duplication.- Returns:
- the new ParallelArray
-
withFilter
Returns an operation prefix that causes a method to operate only on elements for which the current selector (if present) and the given selector returns true- Parameters:
selector
- the selector- Returns:
- operation prefix
-
withFilter
public <V,W> ParallelArrayWithFilter<T> withFilter(Ops.BinaryPredicate<? super T, ? super V> selector, ParallelArrayWithMapping<W, V> other) Returns an operation prefix that causes a method to operate only on elements for which the current selector (if present) and the given binary selector returns true- Parameters:
selector
- the selector- Returns:
- operation prefix
-
withIndexedFilter
public abstract ParallelArrayWithFilter<T> withIndexedFilter(Ops.IntAndObjectPredicate<? super T> selector) Returns an operation prefix that causes a method to operate only on elements for which the current selector (if present) and the given indexed selector returns true- Parameters:
selector
- the selector- Returns:
- operation prefix
-
hasAllEqualElements
Returns true if all elements at the same relative positions of this and other array are equal.- Parameters:
other
- the other array- Returns:
- true if equal
-
hasAllIdenticalElements
Returns true if all elements at the same relative positions of this and other array are identical.- Parameters:
other
- the other array- Returns:
- true if equal
-