Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
206c4375
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
206c4375
编写于
6月 10, 2013
作者:
P
psandoz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8015798: Rename IntStream.longs/doubles and LongStream.doubles to asXxxStream
Reviewed-by: alanb
上级
4a117002
变更
14
显示空白变更内容
内联
并排
Showing
14 changed file
with
35 addition
and
45 deletion
+35
-45
src/share/classes/java/util/stream/IntPipeline.java
src/share/classes/java/util/stream/IntPipeline.java
+3
-3
src/share/classes/java/util/stream/IntStream.java
src/share/classes/java/util/stream/IntStream.java
+2
-2
src/share/classes/java/util/stream/LongPipeline.java
src/share/classes/java/util/stream/LongPipeline.java
+1
-1
src/share/classes/java/util/stream/LongStream.java
src/share/classes/java/util/stream/LongStream.java
+1
-1
test/java/util/stream/boottest/java/util/stream/SpinedBufferTest.java
...il/stream/boottest/java/util/stream/SpinedBufferTest.java
+1
-1
test/java/util/stream/test/org/openjdk/tests/java/util/stream/DoublePrimitiveOpsTests.java
...enjdk/tests/java/util/stream/DoublePrimitiveOpsTests.java
+3
-3
test/java/util/stream/test/org/openjdk/tests/java/util/stream/ExplodeOpTest.java
...est/org/openjdk/tests/java/util/stream/ExplodeOpTest.java
+2
-2
test/java/util/stream/test/org/openjdk/tests/java/util/stream/ForEachOpTest.java
...est/org/openjdk/tests/java/util/stream/ForEachOpTest.java
+1
-1
test/java/util/stream/test/org/openjdk/tests/java/util/stream/MapOpTest.java
...am/test/org/openjdk/tests/java/util/stream/MapOpTest.java
+3
-13
test/java/util/stream/test/org/openjdk/tests/java/util/stream/MatchOpTest.java
.../test/org/openjdk/tests/java/util/stream/MatchOpTest.java
+9
-9
test/java/util/stream/test/org/openjdk/tests/java/util/stream/MinMaxTest.java
...m/test/org/openjdk/tests/java/util/stream/MinMaxTest.java
+2
-2
test/java/util/stream/test/org/openjdk/tests/java/util/stream/PrimitiveSumTest.java
.../org/openjdk/tests/java/util/stream/PrimitiveSumTest.java
+1
-1
test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamBuilderTest.java
...org/openjdk/tests/java/util/stream/StreamBuilderTest.java
+5
-5
test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamSpliteratorTest.java
...openjdk/tests/java/util/stream/StreamSpliteratorTest.java
+1
-1
未找到文件。
src/share/classes/java/util/stream/IntPipeline.java
浏览文件 @
206c4375
...
@@ -183,7 +183,7 @@ abstract class IntPipeline<E_IN>
...
@@ -183,7 +183,7 @@ abstract class IntPipeline<E_IN>
// Stateless intermediate ops from IntStream
// Stateless intermediate ops from IntStream
@Override
@Override
public
final
LongStream
longs
()
{
public
final
LongStream
asLongStream
()
{
return
new
LongPipeline
.
StatelessOp
<
Integer
>(
this
,
StreamShape
.
INT_VALUE
,
return
new
LongPipeline
.
StatelessOp
<
Integer
>(
this
,
StreamShape
.
INT_VALUE
,
StreamOpFlag
.
NOT_SORTED
|
StreamOpFlag
.
NOT_DISTINCT
)
{
StreamOpFlag
.
NOT_SORTED
|
StreamOpFlag
.
NOT_DISTINCT
)
{
@Override
@Override
...
@@ -199,7 +199,7 @@ abstract class IntPipeline<E_IN>
...
@@ -199,7 +199,7 @@ abstract class IntPipeline<E_IN>
}
}
@Override
@Override
public
final
DoubleStream
doubles
()
{
public
final
DoubleStream
asDoubleStream
()
{
return
new
DoublePipeline
.
StatelessOp
<
Integer
>(
this
,
StreamShape
.
INT_VALUE
,
return
new
DoublePipeline
.
StatelessOp
<
Integer
>(
this
,
StreamShape
.
INT_VALUE
,
StreamOpFlag
.
NOT_SORTED
|
StreamOpFlag
.
NOT_DISTINCT
)
{
StreamOpFlag
.
NOT_SORTED
|
StreamOpFlag
.
NOT_DISTINCT
)
{
@Override
@Override
...
@@ -424,7 +424,7 @@ abstract class IntPipeline<E_IN>
...
@@ -424,7 +424,7 @@ abstract class IntPipeline<E_IN>
@Override
@Override
public
final
long
count
()
{
public
final
long
count
()
{
return
longs
().
map
(
e
->
1L
).
sum
();
return
asLongStream
().
map
(
e
->
1L
).
sum
();
}
}
@Override
@Override
...
...
src/share/classes/java/util/stream/IntStream.java
浏览文件 @
206c4375
...
@@ -625,7 +625,7 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
...
@@ -625,7 +625,7 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
* @return a {@code LongStream} consisting of the elements of this stream,
* @return a {@code LongStream} consisting of the elements of this stream,
* converted to {@code long}
* converted to {@code long}
*/
*/
LongStream
longs
();
LongStream
asLongStream
();
/**
/**
* Returns a {@code DoubleStream} consisting of the elements of this stream,
* Returns a {@code DoubleStream} consisting of the elements of this stream,
...
@@ -634,7 +634,7 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
...
@@ -634,7 +634,7 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
* @return a {@code DoubleStream} consisting of the elements of this stream,
* @return a {@code DoubleStream} consisting of the elements of this stream,
* converted to {@code double}
* converted to {@code double}
*/
*/
DoubleStream
doubles
();
DoubleStream
asDoubleStream
();
/**
/**
* Returns a {@code Stream} consisting of the elements of this stream,
* Returns a {@code Stream} consisting of the elements of this stream,
...
...
src/share/classes/java/util/stream/LongPipeline.java
浏览文件 @
206c4375
...
@@ -180,7 +180,7 @@ abstract class LongPipeline<E_IN>
...
@@ -180,7 +180,7 @@ abstract class LongPipeline<E_IN>
// Stateless intermediate ops from LongStream
// Stateless intermediate ops from LongStream
@Override
@Override
public
final
DoubleStream
doubles
()
{
public
final
DoubleStream
asDoubleStream
()
{
return
new
DoublePipeline
.
StatelessOp
<
Long
>(
this
,
StreamShape
.
LONG_VALUE
,
return
new
DoublePipeline
.
StatelessOp
<
Long
>(
this
,
StreamShape
.
LONG_VALUE
,
StreamOpFlag
.
NOT_SORTED
|
StreamOpFlag
.
NOT_DISTINCT
)
{
StreamOpFlag
.
NOT_SORTED
|
StreamOpFlag
.
NOT_DISTINCT
)
{
@Override
@Override
...
...
src/share/classes/java/util/stream/LongStream.java
浏览文件 @
206c4375
...
@@ -625,7 +625,7 @@ public interface LongStream extends BaseStream<Long, LongStream> {
...
@@ -625,7 +625,7 @@ public interface LongStream extends BaseStream<Long, LongStream> {
* @return a {@code DoubleStream} consisting of the elements of this stream,
* @return a {@code DoubleStream} consisting of the elements of this stream,
* converted to {@code double}
* converted to {@code double}
*/
*/
DoubleStream
doubles
();
DoubleStream
asDoubleStream
();
/**
/**
* Returns a {@code Stream} consisting of the elements of this stream,
* Returns a {@code Stream} consisting of the elements of this stream,
...
...
test/java/util/stream/boottest/java/util/stream/SpinedBufferTest.java
浏览文件 @
206c4375
...
@@ -300,7 +300,7 @@ public class SpinedBufferTest {
...
@@ -300,7 +300,7 @@ public class SpinedBufferTest {
for
(
int
size
:
sizes
)
{
for
(
int
size
:
sizes
)
{
// @@@ replace with double range when implemented
// @@@ replace with double range when implemented
double
[]
array
=
LongStream
.
range
(
0
,
size
).
doubles
().
toArray
();
double
[]
array
=
LongStream
.
range
(
0
,
size
).
asDoubleStream
().
toArray
();
SpinedBuffer
.
OfDouble
sb
=
new
SpinedBuffer
.
OfDouble
();
SpinedBuffer
.
OfDouble
sb
=
new
SpinedBuffer
.
OfDouble
();
Arrays
.
stream
(
array
).
forEach
(
sb
);
Arrays
.
stream
(
array
).
forEach
(
sb
);
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/DoublePrimitiveOpsTests.java
浏览文件 @
206c4375
...
@@ -44,12 +44,12 @@ public class DoublePrimitiveOpsTests {
...
@@ -44,12 +44,12 @@ public class DoublePrimitiveOpsTests {
public
void
testToArray
()
{
public
void
testToArray
()
{
{
{
double
[]
array
=
LongStream
.
range
(
1
,
10
).
doubles
().
map
(
i
->
i
*
2
).
toArray
();
double
[]
array
=
LongStream
.
range
(
1
,
10
).
asDoubleStream
().
map
(
i
->
i
*
2
).
toArray
();
assertEquals
(
array
,
new
double
[]{
2
,
4
,
6
,
8
,
10
,
12
,
14
,
16
,
18
});
assertEquals
(
array
,
new
double
[]{
2
,
4
,
6
,
8
,
10
,
12
,
14
,
16
,
18
});
}
}
{
{
double
[]
array
=
LongStream
.
range
(
1
,
10
).
parallel
().
doubles
().
map
(
i
->
i
*
2
).
toArray
();
double
[]
array
=
LongStream
.
range
(
1
,
10
).
parallel
().
asDoubleStream
().
map
(
i
->
i
*
2
).
toArray
();
assertEquals
(
array
,
new
double
[]{
2
,
4
,
6
,
8
,
10
,
12
,
14
,
16
,
18
});
assertEquals
(
array
,
new
double
[]{
2
,
4
,
6
,
8
,
10
,
12
,
14
,
16
,
18
});
}
}
}
}
...
@@ -99,7 +99,7 @@ public class DoublePrimitiveOpsTests {
...
@@ -99,7 +99,7 @@ public class DoublePrimitiveOpsTests {
}
}
{
{
double
[]
actual
=
LongStream
.
range
(
1
,
100
).
parallel
().
doubles
().
limit
(
9
).
toArray
();
double
[]
actual
=
LongStream
.
range
(
1
,
100
).
parallel
().
asDoubleStream
().
limit
(
9
).
toArray
();
Assert
.
assertTrue
(
Arrays
.
equals
(
expected
,
actual
));
Assert
.
assertTrue
(
Arrays
.
equals
(
expected
,
actual
));
}
}
}
}
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/ExplodeOpTest.java
浏览文件 @
206c4375
...
@@ -110,7 +110,7 @@ public class ExplodeOpTest extends OpTestCase {
...
@@ -110,7 +110,7 @@ public class ExplodeOpTest extends OpTestCase {
result
=
exerciseOps
(
data
,
s
->
DoubleStream
.
empty
());
result
=
exerciseOps
(
data
,
s
->
DoubleStream
.
empty
());
assertEquals
(
0
,
result
.
size
());
assertEquals
(
0
,
result
.
size
());
exerciseOps
(
data
,
s
->
s
.
flatMap
(
e
->
IntStream
.
range
(
0
,
(
int
)
e
).
doubles
()));
exerciseOps
(
data
,
s
->
s
.
flatMap
(
e
->
IntStream
.
range
(
0
,
(
int
)
e
).
asDoubleStream
()));
exerciseOps
(
data
,
s
->
s
.
flatMap
(
e
->
IntStream
.
range
(
0
,
(
int
)
e
).
limit
(
10
).
doubles
()));
exerciseOps
(
data
,
s
->
s
.
flatMap
(
e
->
IntStream
.
range
(
0
,
(
int
)
e
).
limit
(
10
).
asDoubleStream
()));
}
}
}
}
test/java/util/stream/test/org/openjdk/tests/java/util/stream/ForEachOpTest.java
浏览文件 @
206c4375
...
@@ -205,7 +205,7 @@ public class ForEachOpTest extends OpTestCase {
...
@@ -205,7 +205,7 @@ public class ForEachOpTest extends OpTestCase {
public
void
testDoubleForEachOrdered
()
{
public
void
testDoubleForEachOrdered
()
{
List
<
Integer
>
input
=
countTo
(
10000
);
List
<
Integer
>
input
=
countTo
(
10000
);
TestData
.
OfDouble
data
=
TestData
.
Factory
.
ofDoubleSupplier
(
"[1, 10000]"
,
TestData
.
OfDouble
data
=
TestData
.
Factory
.
ofDoubleSupplier
(
"[1, 10000]"
,
()
->
IntStream
.
range
(
1
,
10001
).
doubles
());
()
->
IntStream
.
range
(
1
,
10001
).
asDoubleStream
());
Function
<
DoubleStream
,
List
<
Integer
>>
terminalFunc
=
s
->
{
Function
<
DoubleStream
,
List
<
Integer
>>
terminalFunc
=
s
->
{
List
<
Integer
>
l
=
new
ArrayList
<>();
List
<
Integer
>
l
=
new
ArrayList
<>();
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/MapOpTest.java
浏览文件 @
206c4375
...
@@ -24,16 +24,6 @@ package org.openjdk.tests.java.util.stream;
...
@@ -24,16 +24,6 @@ package org.openjdk.tests.java.util.stream;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
java.util.function.DoubleToIntFunction
;
import
java.util.function.DoubleToLongFunction
;
import
java.util.function.Function
;
import
java.util.function.IntToDoubleFunction
;
import
java.util.function.IntToLongFunction
;
import
java.util.function.LongToDoubleFunction
;
import
java.util.function.LongToIntFunction
;
import
java.util.function.ToDoubleFunction
;
import
java.util.function.ToIntFunction
;
import
java.util.function.ToLongFunction
;
import
java.util.stream.*
;
import
java.util.stream.*
;
import
static
java
.
util
.
stream
.
LambdaTestHelpers
.*;
import
static
java
.
util
.
stream
.
LambdaTestHelpers
.*;
...
@@ -98,8 +88,8 @@ public class MapOpTest extends OpTestCase {
...
@@ -98,8 +88,8 @@ public class MapOpTest extends OpTestCase {
exerciseOps
(
data
,
s
->
s
.
mapToObj
(
i
->
i
));
exerciseOps
(
data
,
s
->
s
.
mapToObj
(
i
->
i
));
exerciseOps
(
data
,
s
->
s
.
map
(
i
->
0
));
exerciseOps
(
data
,
s
->
s
.
map
(
i
->
0
));
exerciseOps
(
data
,
s
->
s
.
map
(
i
->
i
*
2
));
exerciseOps
(
data
,
s
->
s
.
map
(
i
->
i
*
2
));
exerciseOps
(
data
,
s
->
s
.
longs
());
exerciseOps
(
data
,
s
->
s
.
asLongStream
());
exerciseOps
(
data
,
s
->
s
.
doubles
());
exerciseOps
(
data
,
s
->
s
.
asDoubleStream
());
exerciseOps
(
data
,
s
->
s
.
boxed
());
exerciseOps
(
data
,
s
->
s
.
boxed
());
exerciseOps
(
data
,
s
->
s
.
mapToObj
(
Integer:
:
toString
));
exerciseOps
(
data
,
s
->
s
.
mapToObj
(
Integer:
:
toString
));
exerciseOps
(
data
,
s
->
s
.
mapToLong
(
i
->
i
));
exerciseOps
(
data
,
s
->
s
.
mapToLong
(
i
->
i
));
...
@@ -113,7 +103,7 @@ public class MapOpTest extends OpTestCase {
...
@@ -113,7 +103,7 @@ public class MapOpTest extends OpTestCase {
exerciseOps
(
data
,
s
->
s
.
mapToObj
(
i
->
i
));
exerciseOps
(
data
,
s
->
s
.
mapToObj
(
i
->
i
));
exerciseOps
(
data
,
s
->
s
.
map
(
i
->
0L
));
exerciseOps
(
data
,
s
->
s
.
map
(
i
->
0L
));
exerciseOps
(
data
,
s
->
s
.
map
(
i
->
i
*
2L
));
exerciseOps
(
data
,
s
->
s
.
map
(
i
->
i
*
2L
));
exerciseOps
(
data
,
s
->
s
.
doubles
());
exerciseOps
(
data
,
s
->
s
.
asDoubleStream
());
exerciseOps
(
data
,
s
->
s
.
boxed
());
exerciseOps
(
data
,
s
->
s
.
boxed
());
exerciseOps
(
data
,
s
->
s
.
mapToObj
(
e
->
Long
.
toString
(
e
)));
exerciseOps
(
data
,
s
->
s
.
mapToObj
(
e
->
Long
.
toString
(
e
)));
exerciseOps
(
data
,
s
->
s
.
mapToInt
(
i
->
(
int
)
i
));
exerciseOps
(
data
,
s
->
s
.
mapToInt
(
i
->
(
int
)
i
));
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/MatchOpTest.java
浏览文件 @
206c4375
...
@@ -318,17 +318,17 @@ public class MatchOpTest extends OpTestCase {
...
@@ -318,17 +318,17 @@ public class MatchOpTest extends OpTestCase {
}
}
public
void
testDoubleStreamMatches
()
{
public
void
testDoubleStreamMatches
()
{
assertDoublePredicates
(()
->
LongStream
.
range
(
0
,
0
).
doubles
(),
Kind
.
ANY
,
DOUBLE_PREDICATES
,
false
,
false
,
false
,
false
);
assertDoublePredicates
(()
->
LongStream
.
range
(
0
,
0
).
asDoubleStream
(),
Kind
.
ANY
,
DOUBLE_PREDICATES
,
false
,
false
,
false
,
false
);
assertDoublePredicates
(()
->
LongStream
.
range
(
0
,
0
).
doubles
(),
Kind
.
ALL
,
DOUBLE_PREDICATES
,
true
,
true
,
true
,
true
);
assertDoublePredicates
(()
->
LongStream
.
range
(
0
,
0
).
asDoubleStream
(),
Kind
.
ALL
,
DOUBLE_PREDICATES
,
true
,
true
,
true
,
true
);
assertDoublePredicates
(()
->
LongStream
.
range
(
0
,
0
).
doubles
(),
Kind
.
NONE
,
DOUBLE_PREDICATES
,
true
,
true
,
true
,
true
);
assertDoublePredicates
(()
->
LongStream
.
range
(
0
,
0
).
asDoubleStream
(),
Kind
.
NONE
,
DOUBLE_PREDICATES
,
true
,
true
,
true
,
true
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
2
).
doubles
(),
Kind
.
ANY
,
DOUBLE_PREDICATES
,
true
,
false
,
false
,
true
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
2
).
asDoubleStream
(),
Kind
.
ANY
,
DOUBLE_PREDICATES
,
true
,
false
,
false
,
true
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
2
).
doubles
(),
Kind
.
ALL
,
DOUBLE_PREDICATES
,
true
,
false
,
false
,
true
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
2
).
asDoubleStream
(),
Kind
.
ALL
,
DOUBLE_PREDICATES
,
true
,
false
,
false
,
true
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
2
).
doubles
(),
Kind
.
NONE
,
DOUBLE_PREDICATES
,
false
,
true
,
true
,
false
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
2
).
asDoubleStream
(),
Kind
.
NONE
,
DOUBLE_PREDICATES
,
false
,
true
,
true
,
false
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
6
).
doubles
(),
Kind
.
ANY
,
DOUBLE_PREDICATES
,
true
,
false
,
true
,
true
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
6
).
asDoubleStream
(),
Kind
.
ANY
,
DOUBLE_PREDICATES
,
true
,
false
,
true
,
true
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
6
).
doubles
(),
Kind
.
ALL
,
DOUBLE_PREDICATES
,
true
,
false
,
false
,
false
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
6
).
asDoubleStream
(),
Kind
.
ALL
,
DOUBLE_PREDICATES
,
true
,
false
,
false
,
false
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
6
).
doubles
(),
Kind
.
NONE
,
DOUBLE_PREDICATES
,
false
,
true
,
false
,
false
);
assertDoublePredicates
(()
->
LongStream
.
range
(
1
,
6
).
asDoubleStream
(),
Kind
.
NONE
,
DOUBLE_PREDICATES
,
false
,
true
,
false
,
false
);
}
}
@Test
(
dataProvider
=
"DoubleStreamTestData"
,
dataProviderClass
=
DoubleStreamTestDataProvider
.
class
)
@Test
(
dataProvider
=
"DoubleStreamTestData"
,
dataProviderClass
=
DoubleStreamTestDataProvider
.
class
)
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/MinMaxTest.java
浏览文件 @
206c4375
...
@@ -80,8 +80,8 @@ public class MinMaxTest extends OpTestCase {
...
@@ -80,8 +80,8 @@ public class MinMaxTest extends OpTestCase {
public
void
testDoubleMinMax
()
{
public
void
testDoubleMinMax
()
{
assertEquals
(
DoubleStream
.
empty
().
min
(),
OptionalDouble
.
empty
());
assertEquals
(
DoubleStream
.
empty
().
min
(),
OptionalDouble
.
empty
());
assertEquals
(
DoubleStream
.
empty
().
max
(),
OptionalDouble
.
empty
());
assertEquals
(
DoubleStream
.
empty
().
max
(),
OptionalDouble
.
empty
());
assertEquals
(
1.0
,
LongStream
.
range
(
1
,
1001
).
doubles
().
min
().
getAsDouble
());
assertEquals
(
1.0
,
LongStream
.
range
(
1
,
1001
).
asDoubleStream
().
min
().
getAsDouble
());
assertEquals
(
1000.0
,
LongStream
.
range
(
1
,
1001
).
doubles
().
max
().
getAsDouble
());
assertEquals
(
1000.0
,
LongStream
.
range
(
1
,
1001
).
asDoubleStream
().
max
().
getAsDouble
());
}
}
@Test
(
dataProvider
=
"DoubleStreamTestData"
,
dataProviderClass
=
DoubleStreamTestDataProvider
.
class
)
@Test
(
dataProvider
=
"DoubleStreamTestData"
,
dataProviderClass
=
DoubleStreamTestDataProvider
.
class
)
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/PrimitiveSumTest.java
浏览文件 @
206c4375
...
@@ -34,7 +34,7 @@ public class PrimitiveSumTest extends OpTestCase {
...
@@ -34,7 +34,7 @@ public class PrimitiveSumTest extends OpTestCase {
withData
(
data
).
withData
(
data
).
terminal
(
s
->
(
long
)
s
.
sum
()).
terminal
(
s
->
(
long
)
s
.
sum
()).
expectedResult
(
data
.
stream
().
longs
().
reduce
(
0
,
LambdaTestHelpers
.
lrPlus
)).
expectedResult
(
data
.
stream
().
asLongStream
().
reduce
(
0
,
LambdaTestHelpers
.
lrPlus
)).
exercise
();
exercise
();
}
}
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamBuilderTest.java
浏览文件 @
206c4375
...
@@ -275,7 +275,7 @@ public class StreamBuilderTest extends OpTestCase {
...
@@ -275,7 +275,7 @@ public class StreamBuilderTest extends OpTestCase {
@Test
(
dataProvider
=
"sizes"
)
@Test
(
dataProvider
=
"sizes"
)
public
void
testDoubleAfterBuilding
(
int
size
)
{
public
void
testDoubleAfterBuilding
(
int
size
)
{
StreamBuilder
.
OfDouble
sb
=
DoubleStream
.
builder
();
StreamBuilder
.
OfDouble
sb
=
DoubleStream
.
builder
();
IntStream
.
range
(
0
,
size
).
doubles
().
forEach
(
sb
);
IntStream
.
range
(
0
,
size
).
asDoubleStream
().
forEach
(
sb
);
sb
.
build
();
sb
.
build
();
checkISE
(()
->
sb
.
accept
(
1
));
checkISE
(()
->
sb
.
accept
(
1
));
...
@@ -287,13 +287,13 @@ public class StreamBuilderTest extends OpTestCase {
...
@@ -287,13 +287,13 @@ public class StreamBuilderTest extends OpTestCase {
public
void
testDoubleStreamBuilder
(
int
size
)
{
public
void
testDoubleStreamBuilder
(
int
size
)
{
testDoubleStreamBuilder
(
size
,
(
s
)
->
{
testDoubleStreamBuilder
(
size
,
(
s
)
->
{
StreamBuilder
.
OfDouble
sb
=
DoubleStream
.
builder
();
StreamBuilder
.
OfDouble
sb
=
DoubleStream
.
builder
();
IntStream
.
range
(
0
,
s
).
doubles
().
forEach
(
sb
);
IntStream
.
range
(
0
,
s
).
asDoubleStream
().
forEach
(
sb
);
return
sb
.
build
();
return
sb
.
build
();
});
});
testDoubleStreamBuilder
(
size
,
(
s
)
->
{
testDoubleStreamBuilder
(
size
,
(
s
)
->
{
StreamBuilder
.
OfDouble
sb
=
DoubleStream
.
builder
();
StreamBuilder
.
OfDouble
sb
=
DoubleStream
.
builder
();
IntStream
.
range
(
0
,
s
).
doubles
().
forEach
(
i
->
{
IntStream
.
range
(
0
,
s
).
asDoubleStream
().
forEach
(
i
->
{
StreamBuilder
.
OfDouble
_sb
=
sb
.
add
(
i
);
StreamBuilder
.
OfDouble
_sb
=
sb
.
add
(
i
);
assertTrue
(
sb
==
_sb
);
assertTrue
(
sb
==
_sb
);
});
});
...
@@ -307,12 +307,12 @@ public class StreamBuilderTest extends OpTestCase {
...
@@ -307,12 +307,12 @@ public class StreamBuilderTest extends OpTestCase {
withData
(
data
).
withData
(
data
).
stream
(
s
->
s
).
stream
(
s
->
s
).
expectedResult
(
IntStream
.
range
(
0
,
size
).
doubles
().
toArray
()).
expectedResult
(
IntStream
.
range
(
0
,
size
).
asDoubleStream
().
toArray
()).
exercise
();
exercise
();
withData
(
data
).
withData
(
data
).
stream
(
s
->
s
.
map
(
i
->
i
)).
stream
(
s
->
s
.
map
(
i
->
i
)).
expectedResult
(
IntStream
.
range
(
0
,
size
).
doubles
().
toArray
()).
expectedResult
(
IntStream
.
range
(
0
,
size
).
asDoubleStream
().
toArray
()).
exercise
();
exercise
();
}
}
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamSpliteratorTest.java
浏览文件 @
206c4375
...
@@ -526,7 +526,7 @@ public class StreamSpliteratorTest extends OpTestCase {
...
@@ -526,7 +526,7 @@ public class StreamSpliteratorTest extends OpTestCase {
for
(
boolean
proxyEstimateSize
:
new
boolean
[]{
false
,
true
})
{
for
(
boolean
proxyEstimateSize
:
new
boolean
[]{
false
,
true
})
{
// Size is assumed to be larger than the target size for no splitting
// Size is assumed to be larger than the target size for no splitting
// @@@ Need way to obtain the target size
// @@@ Need way to obtain the target size
Spliterator
.
OfDouble
sp
=
intermediateOp
.
apply
(
IntStream
.
range
(
0
,
1000
).
doubles
()).
spliterator
();
Spliterator
.
OfDouble
sp
=
intermediateOp
.
apply
(
IntStream
.
range
(
0
,
1000
).
asDoubleStream
()).
spliterator
();
ProxyNoExactSizeSpliterator
.
OfDouble
psp
=
new
ProxyNoExactSizeSpliterator
.
OfDouble
(
sp
,
proxyEstimateSize
);
ProxyNoExactSizeSpliterator
.
OfDouble
psp
=
new
ProxyNoExactSizeSpliterator
.
OfDouble
(
sp
,
proxyEstimateSize
);
DoubleStream
s
=
StreamSupport
.
doubleParallelStream
(
psp
);
DoubleStream
s
=
StreamSupport
.
doubleParallelStream
(
psp
);
terminalOp
.
accept
(
s
);
terminalOp
.
accept
(
s
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录