-
Notifications
You must be signed in to change notification settings - Fork 587
/
PrimitiveStreams.java
185 lines (157 loc) · 6.25 KB
/
PrimitiveStreams.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/*
* Copyright (c) 2022 The Bank of New York Mellon.
* 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.impl.stream;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import org.eclipse.collections.api.bag.primitive.ImmutableDoubleBag;
import org.eclipse.collections.api.bag.primitive.ImmutableIntBag;
import org.eclipse.collections.api.bag.primitive.ImmutableLongBag;
import org.eclipse.collections.api.bag.primitive.MutableDoubleBag;
import org.eclipse.collections.api.bag.primitive.MutableIntBag;
import org.eclipse.collections.api.bag.primitive.MutableLongBag;
import org.eclipse.collections.api.factory.primitive.DoubleLists;
import org.eclipse.collections.api.factory.primitive.DoubleSets;
import org.eclipse.collections.api.factory.primitive.DoubleStacks;
import org.eclipse.collections.api.factory.primitive.IntLists;
import org.eclipse.collections.api.factory.primitive.IntSets;
import org.eclipse.collections.api.factory.primitive.IntStacks;
import org.eclipse.collections.api.factory.primitive.LongLists;
import org.eclipse.collections.api.factory.primitive.LongSets;
import org.eclipse.collections.api.factory.primitive.LongStacks;
import org.eclipse.collections.api.list.primitive.ImmutableDoubleList;
import org.eclipse.collections.api.list.primitive.ImmutableIntList;
import org.eclipse.collections.api.list.primitive.ImmutableLongList;
import org.eclipse.collections.api.list.primitive.MutableDoubleList;
import org.eclipse.collections.api.list.primitive.MutableIntList;
import org.eclipse.collections.api.list.primitive.MutableLongList;
import org.eclipse.collections.api.set.primitive.ImmutableDoubleSet;
import org.eclipse.collections.api.set.primitive.ImmutableIntSet;
import org.eclipse.collections.api.set.primitive.ImmutableLongSet;
import org.eclipse.collections.api.set.primitive.MutableDoubleSet;
import org.eclipse.collections.api.set.primitive.MutableIntSet;
import org.eclipse.collections.api.set.primitive.MutableLongSet;
import org.eclipse.collections.api.stack.primitive.ImmutableDoubleStack;
import org.eclipse.collections.api.stack.primitive.ImmutableIntStack;
import org.eclipse.collections.api.stack.primitive.ImmutableLongStack;
import org.eclipse.collections.api.stack.primitive.MutableDoubleStack;
import org.eclipse.collections.api.stack.primitive.MutableIntStack;
import org.eclipse.collections.api.stack.primitive.MutableLongStack;
import org.eclipse.collections.impl.factory.primitive.DoubleBags;
import org.eclipse.collections.impl.factory.primitive.IntBags;
import org.eclipse.collections.impl.factory.primitive.LongBags;
/**
* This class provides interop between primitive streams and primitive collections.
*
* @since 9.0
*/
public final class PrimitiveStreams
{
private PrimitiveStreams()
{
throw new AssertionError("Suppress default constructor for noninstantiability");
}
public static MutableIntList mIntList(IntStream stream)
{
return IntLists.mutable.withAll(stream);
}
public static ImmutableIntList iIntList(IntStream stream)
{
return IntLists.immutable.withAll(stream);
}
public static MutableIntSet mIntSet(IntStream stream)
{
return IntSets.mutable.withAll(stream);
}
public static ImmutableIntSet iIntSet(IntStream stream)
{
return IntSets.immutable.withAll(stream);
}
public static MutableIntBag mIntBag(IntStream stream)
{
return IntBags.mutable.withAll(stream);
}
public static ImmutableIntBag iIntBag(IntStream stream)
{
return IntBags.immutable.withAll(stream);
}
public static MutableIntStack mIntStack(IntStream stream)
{
return IntStacks.mutable.withAll(stream);
}
public static ImmutableIntStack iIntStack(IntStream stream)
{
return IntStacks.immutable.withAll(stream);
}
public static MutableLongList mLongList(LongStream stream)
{
return LongLists.mutable.withAll(stream);
}
public static ImmutableLongList iLongList(LongStream stream)
{
return LongLists.immutable.withAll(stream);
}
public static MutableLongSet mLongSet(LongStream stream)
{
return LongSets.mutable.withAll(stream);
}
public static ImmutableLongSet iLongSet(LongStream stream)
{
return LongSets.immutable.withAll(stream);
}
public static MutableLongBag mLongBag(LongStream stream)
{
return LongBags.mutable.withAll(stream);
}
public static ImmutableLongBag iLongBag(LongStream stream)
{
return LongBags.immutable.withAll(stream);
}
public static MutableLongStack mLongStack(LongStream stream)
{
return LongStacks.mutable.withAll(stream);
}
public static ImmutableLongStack iLongStack(LongStream stream)
{
return LongStacks.immutable.withAll(stream);
}
public static MutableDoubleList mDoubleList(DoubleStream stream)
{
return DoubleLists.mutable.withAll(stream);
}
public static ImmutableDoubleList iDoubleList(DoubleStream stream)
{
return DoubleLists.immutable.withAll(stream);
}
public static MutableDoubleSet mDoubleSet(DoubleStream stream)
{
return DoubleSets.mutable.withAll(stream);
}
public static ImmutableDoubleSet iDoubleSet(DoubleStream stream)
{
return DoubleSets.immutable.withAll(stream);
}
public static MutableDoubleBag mDoubleBag(DoubleStream stream)
{
return DoubleBags.mutable.withAll(stream);
}
public static ImmutableDoubleBag iDoubleBag(DoubleStream stream)
{
return DoubleBags.immutable.withAll(stream);
}
public static MutableDoubleStack mDoubleStack(DoubleStream stream)
{
return DoubleStacks.mutable.withAll(stream);
}
public static ImmutableDoubleStack iDoubleStack(DoubleStream stream)
{
return DoubleStacks.immutable.withAll(stream);
}
}