133 |
|
* public boolean op(Student s) { return s.credits > 90; } |
134 |
|
* } |
135 |
|
* static final IsSenior isSenior = new IsSenior(); |
136 |
< |
* static final class GpaField implements ObjectToDouble<Student> { |
136 |
> |
* static final class GpaField implements ObjectToDouble<Student> { |
137 |
|
* public double op(Student s) { return s.gpa; } |
138 |
|
* } |
139 |
|
* static final GpaField gpaField = new GpaField(); |
509 |
|
* the given reducer. For example, if the contents are the numbers |
510 |
|
* {@code 1, 2, 3}, and the reducer operation adds numbers, then |
511 |
|
* after invocation of this method, the contents would be {@code 1, |
512 |
< |
* 3, 6} (that is, {@code 1, 1+2, 1+2+3}); |
512 |
> |
* 3, 6} (that is, {@code 1, 1+2, 1+2+3}). |
513 |
|
* @param reducer the reducer |
514 |
|
* @param base the result for an empty array |
515 |
|
* @return this (to simplify use in expressions) |
526 |
|
* 2, 3}, and the reducer operation adds numbers, then after |
527 |
|
* invocation of this method, the contents would be {@code 0, 1, |
528 |
|
* 3} (that is, {@code 0, 0+1, 0+1+2}, and the return value |
529 |
< |
* would be 6 (that is, {@code 1+2+3}); |
529 |
> |
* would be 6 (that is, {@code 1+2+3}). |
530 |
|
* @param reducer the reducer |
531 |
|
* @param base the result for an empty array |
532 |
|
* @return the total reduction |
551 |
|
* Sorts the array, assuming all elements are Comparable. Unlike |
552 |
|
* Arrays.sort, this sort does not guarantee that elements |
553 |
|
* with equal keys maintain their relative position in the array. |
554 |
– |
* @throws ClassCastException if any element is not Comparable |
554 |
|
* @return this (to simplify use in expressions) |
555 |
+ |
* @throws ClassCastException if any element is not Comparable |
556 |
|
*/ |
557 |
|
public ParallelArray<T> sort() { |
558 |
|
super.sort(); |
755 |
|
* @param op the op |
756 |
|
* @return operation prefix |
757 |
|
*/ |
758 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
758 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
759 |
|
(Op<? super T, ? extends U> op) { |
760 |
|
return super.withMapping(op); |
761 |
|
} |
1352 |
|
return a; |
1353 |
|
} |
1354 |
|
|
1355 |
< |
public <V> V[] toArray(V a[]) { |
1355 |
> |
public <V> V[] toArray(V[] a) { |
1356 |
|
int len = fence; |
1357 |
|
if (a.length < len) { |
1358 |
|
Class elementType = a.getClass().getComponentType(); |