/
ParallelListIterable.java
123 lines (108 loc) · 5.09 KB
/
ParallelListIterable.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
* Copyright (c) 2016 Goldman Sachs.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*/
package org.eclipse.collections.api.list;
import org.eclipse.collections.api.ParallelIterable;
import org.eclipse.collections.api.annotation.Beta;
import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.function.Function2;
import org.eclipse.collections.api.block.predicate.Predicate;
import org.eclipse.collections.api.block.predicate.Predicate2;
import org.eclipse.collections.api.multimap.list.ListMultimap;
import org.eclipse.collections.api.set.ParallelUnsortedSetIterable;
/**
* A ParallelIterable is RichIterable which will defer evaluation for certain methods like select, reject, collect, etc.
* Any methods that do not return a ParallelIterable when called will cause evaluation to be forced. Evaluation occurs
* in parallel. All code blocks passed in must be stateless or thread-safe.
*
* @since 5.0
*/
@Beta
public interface ParallelListIterable<T>
extends ParallelIterable<T>
{
@Override
ParallelUnsortedSetIterable<T> asUnique();
/**
* Creates a parallel iterable for selecting elements from the current iterable.
*/
@Override
ParallelListIterable<T> select(Predicate<? super T> predicate);
@Override
<P> ParallelListIterable<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
/**
* Creates a parallel iterable for rejecting elements from the current iterable.
*/
@Override
ParallelListIterable<T> reject(Predicate<? super T> predicate);
@Override
<P> ParallelListIterable<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
@Override
<S> ParallelListIterable<S> selectInstancesOf(Class<S> clazz);
/**
* Creates a parallel iterable for collecting elements from the current iterable.
*/
@Override
<V> ParallelListIterable<V> collect(Function<? super T, ? extends V> function);
@Override
<P, V> ParallelListIterable<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter);
/**
* Creates a parallel iterable for selecting and collecting elements from the current iterable.
*/
@Override
<V> ParallelListIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function);
/**
* Creates a parallel flattening iterable for the current iterable.
*/
@Override
<V> ParallelListIterable<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
@Override
<V> ListMultimap<V, T> groupBy(Function<? super T, ? extends V> function);
@Override
<V> ListMultimap<V, T> groupByEach(Function<? super T, ? extends Iterable<V>> function);
// /**
// * Returns a parallel BooleanIterable which will transform the underlying iterable data to boolean values based on the booleanFunction.
// */
// ParallelBooleanIterable collectBoolean(BooleanFunction<? super T> booleanFunction);
//
// /**
// * Returns a parallel ByteIterable which will transform the underlying iterable data to byte values based on the byteFunction.
// */
// ParallelByteIterable collectByte(ByteFunction<? super T> byteFunction);
//
// /**
// * Returns a parallel CharIterable which will transform the underlying iterable data to char values based on the charFunction.
// */
// ParallelCharIterable collectChar(CharFunction<? super T> charFunction);
//
// /**
// * Returns a parallel DoubleIterable which will transform the underlying iterable data to double values based on the doubleFunction.
// */
// ParallelDoubleIterable collectDouble(DoubleFunction<? super T> doubleFunction);
//
// /**
// * Returns a parallel FloatIterable which will transform the underlying iterable data to float values based on the floatFunction.
// */
// ParallelFloatIterable collectFloat(FloatFunction<? super T> floatFunction);
//
// /**
// * Returns a parallel IntIterable which will transform the underlying iterable data to int values based on the intFunction.
// */
// ParallelIntIterable collectInt(IntFunction<? super T> intFunction);
//
// /**
// * Returns a parallel LongIterable which will transform the underlying iterable data to long values based on the longFunction.
// */
// ParallelLongIterable collectLong(LongFunction<? super T> longFunction);
//
// /**
// * Returns a parallel ShortIterable which will transform the underlying iterable data to short values based on the shortFunction.
// */
// ParallelShortIterable collectShort(ShortFunction<? super T> shortFunction);
}