jsr166y.forkjoin
public static final class ParallelArray.WithBounds<T> extends ParallelArray.WithFilter<T>
Modifier and Type | Method and Description |
---|---|
ParallelArray<T> |
all()
Returns a new ParallelArray holding elements
|
ParallelArray<T> |
all(java.lang.Class<? super T> elementType)
Returns a new ParallelArray with the given element type
holding elements
|
ParallelArray<T> |
allNonidenticalElements()
Returns a new ParallelArray containing only non-null unique
elements (that is, without any duplicates).
|
ParallelArray<T> |
allUniqueElements()
Returns a new ParallelArray containing only non-null unique
elements (that is, without any duplicates).
|
T |
any()
Returns some element matching bound and filter
constraints, or null if none.
|
int |
anyIndex()
Returns the index of some element matching bound and filter
constraints, or -1 if none.
|
int |
binarySearch(T target)
Assuming this array is sorted, returns the index of an
element equal to given target, or -1 if not present.
|
int |
binarySearch(T target,
java.util.Comparator<? super T> comparator)
Assuming this array is sorted with respect to the given
comparator, returns the index of an element equal to given
target, or -1 if not present.
|
<U,V> ParallelArray<V> |
combine(ParallelArray.WithBounds<? extends U> other,
Ops.Combiner<? super T,? super U,? extends V> combiner)
Returns a ParallelArray containing results of
applying combine(thisElement, otherElement)
for each element.
|
<U,V> ParallelArray<V> |
combine(ParallelArray.WithBounds<? extends U> other,
Ops.Combiner<? super T,? super U,? extends V> combiner,
java.lang.Class<? super V> elementType)
Returns a ParallelArray containing results of
applying combine(thisElement, otherElement)
for each element.
|
<U,V> ParallelArray<V> |
combine(ParallelArray<? extends U> other,
Ops.Combiner<? super T,? super U,? extends V> combiner)
Returns a ParallelArray containing results of
applying combine(thisElement, otherElement)
for each element.
|
<U,V> ParallelArray<V> |
combine(ParallelArray<? extends U> other,
Ops.Combiner<? super T,? super U,? extends V> combiner,
java.lang.Class<? super V> elementType)
Returns a ParallelArray containing results of
applying combine(thisElement, otherElement)
for each element.
|
<U,V> ParallelArray<V> |
combine(U[] other,
Ops.Combiner<? super T,? super U,? extends V> combiner)
Returns a ParallelArray containing results of
applying combine(thisElement, otherElement)
for each element.
|
<U,V> ParallelArray<V> |
combine(U[] other,
Ops.Combiner<? super T,? super U,? extends V> combiner,
java.lang.Class<? super V> elementType)
Returns a ParallelArray containing results of
applying combine(thisElement, otherElement)
for each element.
|
void |
cumulate(Ops.Reducer<T> reducer,
T base)
Replaces each element with the running cumulation of applying
the given reducer.
|
int |
indexOf(T target)
Returns the index of some element equal to given target, or
-1 if not present
|
ParallelArray.WithFilter<T> |
orFilter(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) or the given selector returns true
|
T |
precumulate(Ops.Reducer<T> reducer,
T base)
Replaces each element with the cumulation of applying the given
reducer to all previous values, and returns the total
reduction.
|
void |
removeAll()
Removes from the array all elements matching bound and/or
filter constraints.
|
void |
removeConsecutiveDuplicates()
Removes consecutive elements that are equal (or null),
shifting others leftward, and possibly decreasing size.
|
void |
removeNulls()
Removes null elements, shifting others leftward, and possibly
decreasing size.
|
int |
size()
Return the number of elements selected using bound or
filter restrictions.
|
void |
sort()
Sorts the elements, assuming all elements are
Comparable.
|
void |
sort(java.util.Comparator<? super T> cmp)
Sorts the elements.
|
ParallelArray.WithBounds<T> |
withBounds(int firstIndex,
int upperBound)
Returns an operation prefix that causes a method to operate
only on the elements of the array between firstIndex
(inclusive) and upperBound (exclusive).
|
ParallelArray.WithFilter<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 true
|
<U> ParallelArray.WithMapping<T,U> |
withMapping(Ops.Mapper<? super T,? extends U> mapper)
Returns an operation prefix that causes a method to operate
on mapped elements of the array using the given mapper
applied to current mapper's results
|
ParallelArray.WithDoubleMapping<T> |
withMapping(Ops.MapperToDouble<? super T> mapper)
Returns an operation prefix that causes a method to operate
on mapped elements of the array using the given mapper
applied to current mapper's results
|
ParallelArray.WithLongMapping<T> |
withMapping(Ops.MapperToLong<? super T> mapper)
Returns an operation prefix that causes a method to operate
on mapped elements of the array using the given mapper
applied to current mapper's results
|
apply, max, max, min, min, reduce, replaceWithCombination, replaceWithCombination, replaceWithCombination, replaceWithGeneratedValue, replaceWithMappedIndex, replaceWithTransform, replaceWithValue, summary, summary
public ParallelArray.WithBounds<T> withBounds(int firstIndex, int upperBound)
firstIndex
- the lower bound (inclusive)upperBound
- the upper bound (exclusive)public ParallelArray.WithFilter<T> withFilter(Ops.Predicate<? super T> selector)
ParallelArray.WithFilter
withFilter
in class ParallelArray.WithFilter<T>
selector
- the selectorpublic <U> ParallelArray.WithMapping<T,U> withMapping(Ops.Mapper<? super T,? extends U> mapper)
ParallelArray.WithMapping
withMapping
in class ParallelArray.WithMapping<T,T>
mapper
- the mapperpublic ParallelArray.WithDoubleMapping<T> withMapping(Ops.MapperToDouble<? super T> mapper)
ParallelArray.WithMapping
withMapping
in class ParallelArray.WithMapping<T,T>
mapper
- the mapperpublic ParallelArray.WithLongMapping<T> withMapping(Ops.MapperToLong<? super T> mapper)
ParallelArray.WithMapping
withMapping
in class ParallelArray.WithMapping<T,T>
mapper
- the mapperpublic ParallelArray.WithFilter<T> orFilter(Ops.Predicate<? super T> selector)
ParallelArray.WithFilter
orFilter
in class ParallelArray.WithFilter<T>
selector
- the selectorpublic int anyIndex()
ParallelArray.WithMapping
anyIndex
in class ParallelArray.WithMapping<T,T>
public T any()
ParallelArray.WithMapping
any
in class ParallelArray.WithMapping<T,T>
public <U,V> ParallelArray<V> combine(U[] other, Ops.Combiner<? super T,? super U,? extends V> combiner)
other
- the other arraycombiner
- the combinerjava.lang.ArrayIndexOutOfBoundsException
- if other array is
shorter than this array.public <U,V> ParallelArray<V> combine(U[] other, Ops.Combiner<? super T,? super U,? extends V> combiner, java.lang.Class<? super V> elementType)
other
- the other arraycombiner
- the combinerelementType
- the type of elements of returned arrayjava.lang.ArrayIndexOutOfBoundsException
- if other array is
shorter than this array.public <U,V> ParallelArray<V> combine(ParallelArray<? extends U> other, Ops.Combiner<? super T,? super U,? extends V> combiner)
other
- the other arraycombiner
- the combinerjava.lang.ArrayIndexOutOfBoundsException
- if other array is
shorter than this array.public <U,V> ParallelArray<V> combine(ParallelArray<? extends U> other, Ops.Combiner<? super T,? super U,? extends V> combiner, java.lang.Class<? super V> elementType)
other
- the other arraycombiner
- the combinerelementType
- the type of elements of returned arrayjava.lang.ArrayIndexOutOfBoundsException
- if other array is
shorter than this array.public <U,V> ParallelArray<V> combine(ParallelArray.WithBounds<? extends U> other, Ops.Combiner<? super T,? super U,? extends V> combiner)
other
- the other array segmentcombiner
- the combinerjava.lang.ArrayIndexOutOfBoundsException
- if other segment is
shorter than this array.public <U,V> ParallelArray<V> combine(ParallelArray.WithBounds<? extends U> other, Ops.Combiner<? super T,? super U,? extends V> combiner, java.lang.Class<? super V> elementType)
other
- the other array segmentcombiner
- the combinerelementType
- the type of elements of returned arrayjava.lang.ArrayIndexOutOfBoundsException
- if other array is
shorter than this array.public ParallelArray<T> all()
ParallelArray.WithMapping
all
in class ParallelArray.WithMapping<T,T>
public ParallelArray<T> all(java.lang.Class<? super T> elementType)
ParallelArray.WithMapping
all
in class ParallelArray.WithMapping<T,T>
elementType
- the type of the elementspublic ParallelArray<T> allUniqueElements()
ParallelArray.WithFilter
allUniqueElements
in class ParallelArray.WithFilter<T>
public ParallelArray<T> allNonidenticalElements()
ParallelArray.WithFilter
allNonidenticalElements
in class ParallelArray.WithFilter<T>
public int indexOf(T target)
target
- the element to search forpublic int binarySearch(T target)
target
- the element to search forpublic int binarySearch(T target, java.util.Comparator<? super T> comparator)
target
- the element to search forcomparator
- the comparatorpublic int size()
ParallelArray.WithMapping
size
in class ParallelArray.WithMapping<T,T>
public void cumulate(Ops.Reducer<T> reducer, T base)
reducer
- the reducerbase
- the result for an empty arraypublic T precumulate(Ops.Reducer<T> reducer, T base)
reducer
- the reducerbase
- the result for an empty arraypublic void sort(java.util.Comparator<? super T> cmp)
cmp
- the comparator to usepublic void sort()
java.lang.ClassCastException
- if any element is not Comparable.public void removeAll()
ParallelArray.WithFilter
removeAll
in class ParallelArray.WithFilter<T>
public void removeConsecutiveDuplicates()
public void removeNulls()