Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
2b51fd83
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看板
提交
2b51fd83
编写于
10月 16, 2013
作者:
M
mduigou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8025910: rename substream(long) -> skip and remove substream(long,long)
Reviewed-by: psandoz, henryjen
上级
3545dc8f
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
277 addition
and
314 deletion
+277
-314
src/share/classes/java/util/stream/DoublePipeline.java
src/share/classes/java/util/stream/DoublePipeline.java
+5
-12
src/share/classes/java/util/stream/DoubleStream.java
src/share/classes/java/util/stream/DoubleStream.java
+33
-24
src/share/classes/java/util/stream/IntPipeline.java
src/share/classes/java/util/stream/IntPipeline.java
+6
-17
src/share/classes/java/util/stream/IntStream.java
src/share/classes/java/util/stream/IntStream.java
+33
-24
src/share/classes/java/util/stream/LongPipeline.java
src/share/classes/java/util/stream/LongPipeline.java
+6
-17
src/share/classes/java/util/stream/LongStream.java
src/share/classes/java/util/stream/LongStream.java
+33
-24
src/share/classes/java/util/stream/ReferencePipeline.java
src/share/classes/java/util/stream/ReferencePipeline.java
+6
-17
src/share/classes/java/util/stream/Stream.java
src/share/classes/java/util/stream/Stream.java
+33
-24
test/java/util/stream/boottest/java/util/stream/SpinedBufferTest.java
...il/stream/boottest/java/util/stream/SpinedBufferTest.java
+4
-4
test/java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest.java
...tests/java/util/stream/InfiniteStreamWithLimitOpTest.java
+8
-16
test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntSliceOpTest.java
...st/org/openjdk/tests/java/util/stream/IntSliceOpTest.java
+43
-61
test/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java
.../test/org/openjdk/tests/java/util/stream/SliceOpTest.java
+67
-74
未找到文件。
src/share/classes/java/util/stream/DoublePipeline.java
浏览文件 @
2b51fd83
...
@@ -340,24 +340,17 @@ abstract class DoublePipeline<E_IN>
...
@@ -340,24 +340,17 @@ abstract class DoublePipeline<E_IN>
}
}
@Override
@Override
public
final
DoubleStream
s
ubstream
(
long
startingOffset
)
{
public
final
DoubleStream
s
kip
(
long
n
)
{
if
(
startingOffset
<
0
)
if
(
n
<
0
)
throw
new
IllegalArgumentException
(
Long
.
toString
(
startingOffset
));
throw
new
IllegalArgumentException
(
Long
.
toString
(
n
));
if
(
startingOffset
==
0
)
if
(
n
==
0
)
return
this
;
return
this
;
else
{
else
{
long
limit
=
-
1
;
long
limit
=
-
1
;
return
SliceOps
.
makeDouble
(
this
,
startingOffset
,
limit
);
return
SliceOps
.
makeDouble
(
this
,
n
,
limit
);
}
}
}
}
@Override
public
final
DoubleStream
substream
(
long
startingOffset
,
long
endingOffset
)
{
if
(
startingOffset
<
0
||
endingOffset
<
startingOffset
)
throw
new
IllegalArgumentException
(
String
.
format
(
"substream(%d, %d)"
,
startingOffset
,
endingOffset
));
return
SliceOps
.
makeDouble
(
this
,
startingOffset
,
endingOffset
-
startingOffset
);
}
@Override
@Override
public
final
DoubleStream
sorted
()
{
public
final
DoubleStream
sorted
()
{
return
SortedOps
.
makeDouble
(
this
);
return
SortedOps
.
makeDouble
(
this
);
...
...
src/share/classes/java/util/stream/DoubleStream.java
浏览文件 @
2b51fd83
...
@@ -289,6 +289,20 @@ public interface DoubleStream extends BaseStream<Double, DoubleStream> {
...
@@ -289,6 +289,20 @@ public interface DoubleStream extends BaseStream<Double, DoubleStream> {
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
* stateful intermediate operation</a>.
* stateful intermediate operation</a>.
*
*
* @apiNote
* While {@code limit()} is generally a cheap operation on sequential
* stream pipelines, it can be quite expensive on ordered parallel pipelines,
* especially for large values of {@code maxSize}, since {@code limit(n)}
* is constrained to return not just any <em>n</em> elements, but the
* <em>first n</em> elements in the encounter order. Using an unordered
* stream source (such as {@link #generate(DoubleSupplier)}) or removing the
* ordering constraint with {@link #unordered()} may result in significant
* speedups of {@code limit()} in parallel pipelines, if the semantics of
* your situation permit. If consistency with encounter order is required,
* and you are experiencing poor performance or memory utilization with
* {@code limit()} in parallel pipelines, switching to sequential execution
* with {@link #sequential()} may improve performance.
*
* @param maxSize the number of elements the stream should be limited to
* @param maxSize the number of elements the stream should be limited to
* @return the new stream
* @return the new stream
* @throws IllegalArgumentException if {@code maxSize} is negative
* @throws IllegalArgumentException if {@code maxSize} is negative
...
@@ -297,37 +311,32 @@ public interface DoubleStream extends BaseStream<Double, DoubleStream> {
...
@@ -297,37 +311,32 @@ public interface DoubleStream extends BaseStream<Double, DoubleStream> {
/**
/**
* Returns a stream consisting of the remaining elements of this stream
* Returns a stream consisting of the remaining elements of this stream
* after discarding the first {@code
startInclusive
} elements of the stream.
* after discarding the first {@code
n
} elements of the stream.
* If this stream contains fewer than {@code
startInclusive
} elements then an
* If this stream contains fewer than {@code
n
} elements then an
* empty stream will be returned.
* empty stream will be returned.
*
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
* intermediate operation</a>.
*
*
* @param startInclusive the number of leading elements to skip
* @apiNote
* @return the new stream
* While {@code skip()} is generally a cheap operation on sequential
* @throws IllegalArgumentException if {@code startInclusive} is negative
* stream pipelines, it can be quite expensive on ordered parallel pipelines,
*/
* especially for large values of {@code n}, since {@code skip(n)}
DoubleStream
substream
(
long
startInclusive
);
* is constrained to skip not just any <em>n</em> elements, but the
* <em>first n</em> elements in the encounter order. Using an unordered
/**
* stream source (such as {@link #generate(DoubleSupplier)}) or removing the
* Returns a stream consisting of the remaining elements of this stream
* ordering constraint with {@link #unordered()} may result in significant
* after discarding the first {@code startInclusive} elements and truncating
* speedups of {@code skip()} in parallel pipelines, if the semantics of
* the result to be no longer than {@code endExclusive - startInclusive}
* your situation permit. If consistency with encounter order is required,
* elements in length. If this stream contains fewer than
* and you are experiencing poor performance or memory utilization with
* {@code startInclusive} elements then an empty stream will be returned.
* {@code skip()} in parallel pipelines, switching to sequential execution
*
* with {@link #sequential()} may improve performance.
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
*
* stateful intermediate operation</a>.
* @param n the number of leading elements to skip
*
* @param startInclusive the starting position of the substream, inclusive
* @param endExclusive the ending position of the substream, exclusive
* @return the new stream
* @return the new stream
* @throws IllegalArgumentException if {@code startInclusive} or
* @throws IllegalArgumentException if {@code n} is negative
* {@code endExclusive} is negative or {@code startInclusive} is greater
* than {@code endExclusive}
*/
*/
DoubleStream
s
ubstream
(
long
startInclusive
,
long
endExclusive
);
DoubleStream
s
kip
(
long
n
);
/**
/**
* Performs an action for each element of this stream.
* Performs an action for each element of this stream.
...
...
src/share/classes/java/util/stream/IntPipeline.java
浏览文件 @
2b51fd83
...
@@ -368,32 +368,21 @@ abstract class IntPipeline<E_IN>
...
@@ -368,32 +368,21 @@ abstract class IntPipeline<E_IN>
// Stateful intermediate ops from IntStream
// Stateful intermediate ops from IntStream
private
IntStream
slice
(
long
skip
,
long
limit
)
{
return
SliceOps
.
makeInt
(
this
,
skip
,
limit
);
}
@Override
@Override
public
final
IntStream
limit
(
long
maxSize
)
{
public
final
IntStream
limit
(
long
maxSize
)
{
if
(
maxSize
<
0
)
if
(
maxSize
<
0
)
throw
new
IllegalArgumentException
(
Long
.
toString
(
maxSize
));
throw
new
IllegalArgumentException
(
Long
.
toString
(
maxSize
));
return
slice
(
0
,
maxSize
);
return
SliceOps
.
makeInt
(
this
,
0
,
maxSize
);
}
}
@Override
@Override
public
final
IntStream
s
ubstream
(
long
startingOffset
)
{
public
final
IntStream
s
kip
(
long
n
)
{
if
(
startingOffset
<
0
)
if
(
n
<
0
)
throw
new
IllegalArgumentException
(
Long
.
toString
(
startingOffset
));
throw
new
IllegalArgumentException
(
Long
.
toString
(
n
));
if
(
startingOffset
==
0
)
if
(
n
==
0
)
return
this
;
return
this
;
else
else
return
slice
(
startingOffset
,
-
1
);
return
SliceOps
.
makeInt
(
this
,
n
,
-
1
);
}
@Override
public
final
IntStream
substream
(
long
startingOffset
,
long
endingOffset
)
{
if
(
startingOffset
<
0
||
endingOffset
<
startingOffset
)
throw
new
IllegalArgumentException
(
String
.
format
(
"substream(%d, %d)"
,
startingOffset
,
endingOffset
));
return
slice
(
startingOffset
,
endingOffset
-
startingOffset
);
}
}
@Override
@Override
...
...
src/share/classes/java/util/stream/IntStream.java
浏览文件 @
2b51fd83
...
@@ -287,6 +287,20 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
...
@@ -287,6 +287,20 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
* stateful intermediate operation</a>.
* stateful intermediate operation</a>.
*
*
* @apiNote
* While {@code limit()} is generally a cheap operation on sequential
* stream pipelines, it can be quite expensive on ordered parallel pipelines,
* especially for large values of {@code maxSize}, since {@code limit(n)}
* is constrained to return not just any <em>n</em> elements, but the
* <em>first n</em> elements in the encounter order. Using an unordered
* stream source (such as {@link #generate(IntSupplier)}) or removing the
* ordering constraint with {@link #unordered()} may result in significant
* speedups of {@code limit()} in parallel pipelines, if the semantics of
* your situation permit. If consistency with encounter order is required,
* and you are experiencing poor performance or memory utilization with
* {@code limit()} in parallel pipelines, switching to sequential execution
* with {@link #sequential()} may improve performance.
*
* @param maxSize the number of elements the stream should be limited to
* @param maxSize the number of elements the stream should be limited to
* @return the new stream
* @return the new stream
* @throws IllegalArgumentException if {@code maxSize} is negative
* @throws IllegalArgumentException if {@code maxSize} is negative
...
@@ -295,37 +309,32 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
...
@@ -295,37 +309,32 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
/**
/**
* Returns a stream consisting of the remaining elements of this stream
* Returns a stream consisting of the remaining elements of this stream
* after discarding the first {@code
startInclusive
} elements of the stream.
* after discarding the first {@code
n
} elements of the stream.
* If this stream contains fewer than {@code
startInclusive
} elements then an
* If this stream contains fewer than {@code
n
} elements then an
* empty stream will be returned.
* empty stream will be returned.
*
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
* intermediate operation</a>.
*
*
* @param startInclusive the number of leading elements to skip
* @apiNote
* @return the new stream
* While {@code skip()} is generally a cheap operation on sequential
* @throws IllegalArgumentException if {@code startInclusive} is negative
* stream pipelines, it can be quite expensive on ordered parallel pipelines,
*/
* especially for large values of {@code n}, since {@code skip(n)}
IntStream
substream
(
long
startInclusive
);
* is constrained to skip not just any <em>n</em> elements, but the
* <em>first n</em> elements in the encounter order. Using an unordered
/**
* stream source (such as {@link #generate(IntSupplier)}) or removing the
* Returns a stream consisting of the remaining elements of this stream
* ordering constraint with {@link #unordered()} may result in significant
* after discarding the first {@code startInclusive} elements and truncating
* speedups of {@code skip()} in parallel pipelines, if the semantics of
* the result to be no longer than {@code endExclusive - startInclusive}
* your situation permit. If consistency with encounter order is required,
* elements in length. If this stream contains fewer than
* and you are experiencing poor performance or memory utilization with
* {@code startInclusive} elements then an empty stream will be returned.
* {@code skip()} in parallel pipelines, switching to sequential execution
*
* with {@link #sequential()} may improve performance.
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
*
* stateful intermediate operation</a>.
* @param n the number of leading elements to skip
*
* @param startInclusive the starting position of the substream, inclusive
* @param endExclusive the ending position of the substream, exclusive
* @return the new stream
* @return the new stream
* @throws IllegalArgumentException if {@code startInclusive} or
* @throws IllegalArgumentException if {@code n} is negative
* {@code endExclusive} is negative or {@code startInclusive} is greater
* than {@code endExclusive}
*/
*/
IntStream
s
ubstream
(
long
startInclusive
,
long
endExclusive
);
IntStream
s
kip
(
long
n
);
/**
/**
* Performs an action for each element of this stream.
* Performs an action for each element of this stream.
...
...
src/share/classes/java/util/stream/LongPipeline.java
浏览文件 @
2b51fd83
...
@@ -349,32 +349,21 @@ abstract class LongPipeline<E_IN>
...
@@ -349,32 +349,21 @@ abstract class LongPipeline<E_IN>
// Stateful intermediate ops from LongStream
// Stateful intermediate ops from LongStream
private
LongStream
slice
(
long
skip
,
long
limit
)
{
return
SliceOps
.
makeLong
(
this
,
skip
,
limit
);
}
@Override
@Override
public
final
LongStream
limit
(
long
maxSize
)
{
public
final
LongStream
limit
(
long
maxSize
)
{
if
(
maxSize
<
0
)
if
(
maxSize
<
0
)
throw
new
IllegalArgumentException
(
Long
.
toString
(
maxSize
));
throw
new
IllegalArgumentException
(
Long
.
toString
(
maxSize
));
return
slice
(
0
,
maxSize
);
return
SliceOps
.
makeLong
(
this
,
0
,
maxSize
);
}
}
@Override
@Override
public
final
LongStream
s
ubstream
(
long
startingOffset
)
{
public
final
LongStream
s
kip
(
long
n
)
{
if
(
startingOffset
<
0
)
if
(
n
<
0
)
throw
new
IllegalArgumentException
(
Long
.
toString
(
startingOffset
));
throw
new
IllegalArgumentException
(
Long
.
toString
(
n
));
if
(
startingOffset
==
0
)
if
(
n
==
0
)
return
this
;
return
this
;
else
else
return
slice
(
startingOffset
,
-
1
);
return
SliceOps
.
makeLong
(
this
,
n
,
-
1
);
}
@Override
public
final
LongStream
substream
(
long
startingOffset
,
long
endingOffset
)
{
if
(
startingOffset
<
0
||
endingOffset
<
startingOffset
)
throw
new
IllegalArgumentException
(
String
.
format
(
"substream(%d, %d)"
,
startingOffset
,
endingOffset
));
return
slice
(
startingOffset
,
endingOffset
-
startingOffset
);
}
}
@Override
@Override
...
...
src/share/classes/java/util/stream/LongStream.java
浏览文件 @
2b51fd83
...
@@ -287,6 +287,20 @@ public interface LongStream extends BaseStream<Long, LongStream> {
...
@@ -287,6 +287,20 @@ public interface LongStream extends BaseStream<Long, LongStream> {
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
* stateful intermediate operation</a>.
* stateful intermediate operation</a>.
*
*
* @apiNote
* While {@code limit()} is generally a cheap operation on sequential
* stream pipelines, it can be quite expensive on ordered parallel pipelines,
* especially for large values of {@code maxSize}, since {@code limit(n)}
* is constrained to return not just any <em>n</em> elements, but the
* <em>first n</em> elements in the encounter order. Using an unordered
* stream source (such as {@link #generate(LongSupplier)}) or removing the
* ordering constraint with {@link #unordered()} may result in significant
* speedups of {@code limit()} in parallel pipelines, if the semantics of
* your situation permit. If consistency with encounter order is required,
* and you are experiencing poor performance or memory utilization with
* {@code limit()} in parallel pipelines, switching to sequential execution
* with {@link #sequential()} may improve performance.
*
* @param maxSize the number of elements the stream should be limited to
* @param maxSize the number of elements the stream should be limited to
* @return the new stream
* @return the new stream
* @throws IllegalArgumentException if {@code maxSize} is negative
* @throws IllegalArgumentException if {@code maxSize} is negative
...
@@ -295,37 +309,32 @@ public interface LongStream extends BaseStream<Long, LongStream> {
...
@@ -295,37 +309,32 @@ public interface LongStream extends BaseStream<Long, LongStream> {
/**
/**
* Returns a stream consisting of the remaining elements of this stream
* Returns a stream consisting of the remaining elements of this stream
* after discarding the first {@code
startInclusive
} elements of the stream.
* after discarding the first {@code
n
} elements of the stream.
* If this stream contains fewer than {@code
startInclusive
} elements then an
* If this stream contains fewer than {@code
n
} elements then an
* empty stream will be returned.
* empty stream will be returned.
*
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
* intermediate operation</a>.
*
*
* @param startInclusive the number of leading elements to skip
* @apiNote
* @return the new stream
* While {@code skip()} is generally a cheap operation on sequential
* @throws IllegalArgumentException if {@code startInclusive} is negative
* stream pipelines, it can be quite expensive on ordered parallel pipelines,
*/
* especially for large values of {@code n}, since {@code skip(n)}
LongStream
substream
(
long
startInclusive
);
* is constrained to skip not just any <em>n</em> elements, but the
* <em>first n</em> elements in the encounter order. Using an unordered
/**
* stream source (such as {@link #generate(LongSupplier)}) or removing the
* Returns a stream consisting of the remaining elements of this stream
* ordering constraint with {@link #unordered()} may result in significant
* after discarding the first {@code startInclusive} elements and truncating
* speedups of {@code skip()} in parallel pipelines, if the semantics of
* the result to be no longer than {@code endExclusive - startInclusive}
* your situation permit. If consistency with encounter order is required,
* elements in length. If this stream contains fewer than
* and you are experiencing poor performance or memory utilization with
* {@code startInclusive} elements then an empty stream will be returned.
* {@code skip()} in parallel pipelines, switching to sequential execution
*
* with {@link #sequential()} may improve performance.
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
*
* stateful intermediate operation</a>.
* @param n the number of leading elements to skip
*
* @param startInclusive the starting position of the substream, inclusive
* @param endExclusive the ending position of the substream, exclusive
* @return the new stream
* @return the new stream
* @throws IllegalArgumentException if {@code startInclusive} or
* @throws IllegalArgumentException if {@code n} is negative
* {@code endExclusive} is negative or {@code startInclusive} is greater
* than {@code endExclusive}
*/
*/
LongStream
s
ubstream
(
long
startInclusive
,
long
endExclusive
);
LongStream
s
kip
(
long
n
);
/**
/**
* Performs an action for each element of this stream.
* Performs an action for each element of this stream.
...
...
src/share/classes/java/util/stream/ReferencePipeline.java
浏览文件 @
2b51fd83
...
@@ -394,32 +394,21 @@ abstract class ReferencePipeline<P_IN, P_OUT>
...
@@ -394,32 +394,21 @@ abstract class ReferencePipeline<P_IN, P_OUT>
return
SortedOps
.
makeRef
(
this
,
comparator
);
return
SortedOps
.
makeRef
(
this
,
comparator
);
}
}
private
Stream
<
P_OUT
>
slice
(
long
skip
,
long
limit
)
{
return
SliceOps
.
makeRef
(
this
,
skip
,
limit
);
}
@Override
@Override
public
final
Stream
<
P_OUT
>
limit
(
long
maxSize
)
{
public
final
Stream
<
P_OUT
>
limit
(
long
maxSize
)
{
if
(
maxSize
<
0
)
if
(
maxSize
<
0
)
throw
new
IllegalArgumentException
(
Long
.
toString
(
maxSize
));
throw
new
IllegalArgumentException
(
Long
.
toString
(
maxSize
));
return
slice
(
0
,
maxSize
);
return
SliceOps
.
makeRef
(
this
,
0
,
maxSize
);
}
}
@Override
@Override
public
final
Stream
<
P_OUT
>
s
ubstream
(
long
startingOffset
)
{
public
final
Stream
<
P_OUT
>
s
kip
(
long
n
)
{
if
(
startingOffset
<
0
)
if
(
n
<
0
)
throw
new
IllegalArgumentException
(
Long
.
toString
(
startingOffset
));
throw
new
IllegalArgumentException
(
Long
.
toString
(
n
));
if
(
startingOffset
==
0
)
if
(
n
==
0
)
return
this
;
return
this
;
else
else
return
slice
(
startingOffset
,
-
1
);
return
SliceOps
.
makeRef
(
this
,
n
,
-
1
);
}
@Override
public
final
Stream
<
P_OUT
>
substream
(
long
startingOffset
,
long
endingOffset
)
{
if
(
startingOffset
<
0
||
endingOffset
<
startingOffset
)
throw
new
IllegalArgumentException
(
String
.
format
(
"substream(%d, %d)"
,
startingOffset
,
endingOffset
));
return
slice
(
startingOffset
,
endingOffset
-
startingOffset
);
}
}
// Terminal operations from Stream
// Terminal operations from Stream
...
...
src/share/classes/java/util/stream/Stream.java
浏览文件 @
2b51fd83
...
@@ -365,6 +365,20 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
...
@@ -365,6 +365,20 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
* stateful intermediate operation</a>.
* stateful intermediate operation</a>.
*
*
* @apiNote
* While {@code limit()} is generally a cheap operation on sequential
* stream pipelines, it can be quite expensive on ordered parallel pipelines,
* especially for large values of {@code maxSize}, since {@code limit(n)}
* is constrained to return not just any <em>n</em> elements, but the
* <em>first n</em> elements in the encounter order. Using an unordered
* stream source (such as {@link #generate(Supplier)}) or removing the
* ordering constraint with {@link #unordered()} may result in significant
* speedups of {@code limit()} in parallel pipelines, if the semantics of
* your situation permit. If consistency with encounter order is required,
* and you are experiencing poor performance or memory utilization with
* {@code limit()} in parallel pipelines, switching to sequential execution
* with {@link #sequential()} may improve performance.
*
* @param maxSize the number of elements the stream should be limited to
* @param maxSize the number of elements the stream should be limited to
* @return the new stream
* @return the new stream
* @throws IllegalArgumentException if {@code maxSize} is negative
* @throws IllegalArgumentException if {@code maxSize} is negative
...
@@ -373,37 +387,32 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
...
@@ -373,37 +387,32 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
/**
/**
* Returns a stream consisting of the remaining elements of this stream
* Returns a stream consisting of the remaining elements of this stream
* after discarding the first {@code
startInclusive
} elements of the stream.
* after discarding the first {@code
n
} elements of the stream.
* If this stream contains fewer than {@code
startInclusive
} elements then an
* If this stream contains fewer than {@code
n
} elements then an
* empty stream will be returned.
* empty stream will be returned.
*
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
* intermediate operation</a>.
*
*
* @param startInclusive the number of leading elements to skip
* @apiNote
* @return the new stream
* While {@code skip()} is generally a cheap operation on sequential
* @throws IllegalArgumentException if {@code startInclusive} is negative
* stream pipelines, it can be quite expensive on ordered parallel pipelines,
*/
* especially for large values of {@code n}, since {@code skip(n)}
Stream
<
T
>
substream
(
long
startInclusive
);
* is constrained to skip not just any <em>n</em> elements, but the
* <em>first n</em> elements in the encounter order. Using an unordered
/**
* stream source (such as {@link #generate(Supplier)}) or removing the
* Returns a stream consisting of the remaining elements of this stream
* ordering constraint with {@link #unordered()} may result in significant
* after discarding the first {@code startInclusive} elements and truncating
* speedups of {@code skip()} in parallel pipelines, if the semantics of
* the result to be no longer than {@code endExclusive - startInclusive}
* your situation permit. If consistency with encounter order is required,
* elements in length. If this stream contains fewer than
* and you are experiencing poor performance or memory utilization with
* {@code startInclusive} elements then an empty stream will be returned.
* {@code skip()} in parallel pipelines, switching to sequential execution
*
* with {@link #sequential()} may improve performance.
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
*
* stateful intermediate operation</a>.
* @param n the number of leading elements to skip
*
* @param startInclusive the starting position of the substream, inclusive
* @param endExclusive the ending position of the substream, exclusive
* @return the new stream
* @return the new stream
* @throws IllegalArgumentException if {@code startInclusive} or
* @throws IllegalArgumentException if {@code n} is negative
* {@code endExclusive} is negative or {@code startInclusive} is greater
* than {@code endExclusive}
*/
*/
Stream
<
T
>
s
ubstream
(
long
startInclusive
,
long
endExclusive
);
Stream
<
T
>
s
kip
(
long
n
);
/**
/**
* Performs an action for each element of this stream.
* Performs an action for each element of this stream.
...
...
test/java/util/stream/boottest/java/util/stream/SpinedBufferTest.java
浏览文件 @
2b51fd83
...
@@ -109,7 +109,7 @@ public class SpinedBufferTest {
...
@@ -109,7 +109,7 @@ public class SpinedBufferTest {
List
<
Integer
>
end
=
Arrays
.
stream
(
array
)
List
<
Integer
>
end
=
Arrays
.
stream
(
array
)
.
boxed
()
.
boxed
()
.
s
ubstream
(
array
.
length
-
lastSplitSize
)
.
s
kip
(
array
.
length
-
lastSplitSize
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
assertEquals
(
contentOfLastSplit
,
end
);
assertEquals
(
contentOfLastSplit
,
end
);
}
}
...
@@ -184,7 +184,7 @@ public class SpinedBufferTest {
...
@@ -184,7 +184,7 @@ public class SpinedBufferTest {
List
<
Integer
>
end
=
Arrays
.
stream
(
array
)
List
<
Integer
>
end
=
Arrays
.
stream
(
array
)
.
boxed
()
.
boxed
()
.
s
ubstream
(
array
.
length
-
lastSplitSize
)
.
s
kip
(
array
.
length
-
lastSplitSize
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
assertEquals
(
contentOfLastSplit
,
end
);
assertEquals
(
contentOfLastSplit
,
end
);
}
}
...
@@ -259,7 +259,7 @@ public class SpinedBufferTest {
...
@@ -259,7 +259,7 @@ public class SpinedBufferTest {
List
<
Long
>
end
=
Arrays
.
stream
(
array
)
List
<
Long
>
end
=
Arrays
.
stream
(
array
)
.
boxed
()
.
boxed
()
.
s
ubstream
(
array
.
length
-
lastSplitSize
)
.
s
kip
(
array
.
length
-
lastSplitSize
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
assertEquals
(
contentOfLastSplit
,
end
);
assertEquals
(
contentOfLastSplit
,
end
);
}
}
...
@@ -335,7 +335,7 @@ public class SpinedBufferTest {
...
@@ -335,7 +335,7 @@ public class SpinedBufferTest {
List
<
Double
>
end
=
Arrays
.
stream
(
array
)
List
<
Double
>
end
=
Arrays
.
stream
(
array
)
.
boxed
()
.
boxed
()
.
s
ubstream
(
array
.
length
-
lastSplitSize
)
.
s
kip
(
array
.
length
-
lastSplitSize
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
assertEquals
(
contentOfLastSplit
,
end
);
assertEquals
(
contentOfLastSplit
,
end
);
}
}
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest.java
浏览文件 @
2b51fd83
...
@@ -63,10 +63,8 @@ public class InfiniteStreamWithLimitOpTest extends OpTestCase {
...
@@ -63,10 +63,8 @@ public class InfiniteStreamWithLimitOpTest extends OpTestCase {
data
.
add
(
new
Object
[]{
f
.
apply
(
"Stream.limit(%d)"
),
data
.
add
(
new
Object
[]{
f
.
apply
(
"Stream.limit(%d)"
),
(
UnaryOperator
<
Stream
>)
s
->
s
.
limit
(
SKIP_LIMIT_SIZE
)});
(
UnaryOperator
<
Stream
>)
s
->
s
.
limit
(
SKIP_LIMIT_SIZE
)});
data
.
add
(
new
Object
[]{
f
.
apply
(
"Stream.substream(%d)"
),
data
.
add
(
new
Object
[]{
f
.
apply
(
"Stream.skip(%1$d).limit(%1$d)"
),
(
UnaryOperator
<
Stream
>)
s
->
s
.
substream
(
SKIP_LIMIT_SIZE
,
SKIP_LIMIT_SIZE
*
2
)});
(
UnaryOperator
<
Stream
>)
s
->
s
.
skip
(
SKIP_LIMIT_SIZE
).
limit
(
SKIP_LIMIT_SIZE
)});
data
.
add
(
new
Object
[]{
f
.
apply
(
"Stream.substream(%1$d).limit(%1$d)"
),
(
UnaryOperator
<
Stream
>)
s
->
s
.
substream
(
SKIP_LIMIT_SIZE
).
limit
(
SKIP_LIMIT_SIZE
)});
return
data
.
toArray
(
new
Object
[
0
][]);
return
data
.
toArray
(
new
Object
[
0
][]);
}
}
...
@@ -79,10 +77,8 @@ public class InfiniteStreamWithLimitOpTest extends OpTestCase {
...
@@ -79,10 +77,8 @@ public class InfiniteStreamWithLimitOpTest extends OpTestCase {
data
.
add
(
new
Object
[]{
f
.
apply
(
"IntStream.limit(%d)"
),
data
.
add
(
new
Object
[]{
f
.
apply
(
"IntStream.limit(%d)"
),
(
UnaryOperator
<
IntStream
>)
s
->
s
.
limit
(
SKIP_LIMIT_SIZE
)});
(
UnaryOperator
<
IntStream
>)
s
->
s
.
limit
(
SKIP_LIMIT_SIZE
)});
data
.
add
(
new
Object
[]{
f
.
apply
(
"IntStream.substream(%d)"
),
data
.
add
(
new
Object
[]{
f
.
apply
(
"IntStream.skip(%1$d).limit(%1$d)"
),
(
UnaryOperator
<
IntStream
>)
s
->
s
.
substream
(
SKIP_LIMIT_SIZE
,
SKIP_LIMIT_SIZE
*
2
)});
(
UnaryOperator
<
IntStream
>)
s
->
s
.
skip
(
SKIP_LIMIT_SIZE
).
limit
(
SKIP_LIMIT_SIZE
)});
data
.
add
(
new
Object
[]{
f
.
apply
(
"IntStream.substream(%1$d).limit(%1$d)"
),
(
UnaryOperator
<
IntStream
>)
s
->
s
.
substream
(
SKIP_LIMIT_SIZE
).
limit
(
SKIP_LIMIT_SIZE
)});
return
data
.
toArray
(
new
Object
[
0
][]);
return
data
.
toArray
(
new
Object
[
0
][]);
}
}
...
@@ -95,10 +91,8 @@ public class InfiniteStreamWithLimitOpTest extends OpTestCase {
...
@@ -95,10 +91,8 @@ public class InfiniteStreamWithLimitOpTest extends OpTestCase {
data
.
add
(
new
Object
[]{
f
.
apply
(
"LongStream.limit(%d)"
),
data
.
add
(
new
Object
[]{
f
.
apply
(
"LongStream.limit(%d)"
),
(
UnaryOperator
<
LongStream
>)
s
->
s
.
limit
(
SKIP_LIMIT_SIZE
)});
(
UnaryOperator
<
LongStream
>)
s
->
s
.
limit
(
SKIP_LIMIT_SIZE
)});
data
.
add
(
new
Object
[]{
f
.
apply
(
"LongStream.substream(%d)"
),
data
.
add
(
new
Object
[]{
f
.
apply
(
"LongStream.skip(%1$d).limit(%1$d)"
),
(
UnaryOperator
<
LongStream
>)
s
->
s
.
substream
(
SKIP_LIMIT_SIZE
,
SKIP_LIMIT_SIZE
*
2
)});
(
UnaryOperator
<
LongStream
>)
s
->
s
.
skip
(
SKIP_LIMIT_SIZE
).
limit
(
SKIP_LIMIT_SIZE
)});
data
.
add
(
new
Object
[]{
f
.
apply
(
"LongStream.substream(%1$d).limit(%1$d)"
),
(
UnaryOperator
<
LongStream
>)
s
->
s
.
substream
(
SKIP_LIMIT_SIZE
).
limit
(
SKIP_LIMIT_SIZE
)});
return
data
.
toArray
(
new
Object
[
0
][]);
return
data
.
toArray
(
new
Object
[
0
][]);
}
}
...
@@ -111,10 +105,8 @@ public class InfiniteStreamWithLimitOpTest extends OpTestCase {
...
@@ -111,10 +105,8 @@ public class InfiniteStreamWithLimitOpTest extends OpTestCase {
data
.
add
(
new
Object
[]{
f
.
apply
(
"DoubleStream.limit(%d)"
),
data
.
add
(
new
Object
[]{
f
.
apply
(
"DoubleStream.limit(%d)"
),
(
UnaryOperator
<
DoubleStream
>)
s
->
s
.
limit
(
SKIP_LIMIT_SIZE
)});
(
UnaryOperator
<
DoubleStream
>)
s
->
s
.
limit
(
SKIP_LIMIT_SIZE
)});
data
.
add
(
new
Object
[]{
f
.
apply
(
"DoubleStream.substream(%d)"
),
data
.
add
(
new
Object
[]{
f
.
apply
(
"DoubleStream.skip(%1$d).limit(%1$d)"
),
(
UnaryOperator
<
DoubleStream
>)
s
->
s
.
substream
(
SKIP_LIMIT_SIZE
,
SKIP_LIMIT_SIZE
*
2
)});
(
UnaryOperator
<
DoubleStream
>)
s
->
s
.
skip
(
SKIP_LIMIT_SIZE
).
limit
(
SKIP_LIMIT_SIZE
)});
data
.
add
(
new
Object
[]{
f
.
apply
(
"DoubleStream.substream(%1$d).limit(%1$d)"
),
(
UnaryOperator
<
DoubleStream
>)
s
->
s
.
substream
(
SKIP_LIMIT_SIZE
).
limit
(
SKIP_LIMIT_SIZE
)});
return
data
.
toArray
(
new
Object
[
0
][]);
return
data
.
toArray
(
new
Object
[
0
][]);
}
}
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntSliceOpTest.java
浏览文件 @
2b51fd83
...
@@ -44,27 +44,27 @@ public class IntSliceOpTest extends OpTestCase {
...
@@ -44,27 +44,27 @@ public class IntSliceOpTest extends OpTestCase {
private
static
final
int
[]
EMPTY_INT_ARRAY
=
new
int
[
0
];
private
static
final
int
[]
EMPTY_INT_ARRAY
=
new
int
[
0
];
public
void
testSkip
()
{
public
void
testSkip
()
{
assertCountSum
(
IntStream
.
range
(
0
,
0
).
s
ubstream
(
0
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
0
,
0
).
s
kip
(
0
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
0
,
0
).
s
ubstream
(
4
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
0
,
0
).
s
kip
(
4
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
s
ubstream
(
4
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
s
kip
(
4
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
s
ubstream
(
2
).
boxed
(),
2
,
7
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
s
kip
(
2
).
boxed
(),
2
,
7
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
s
ubstream
(
0
).
boxed
(),
4
,
10
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
s
kip
(
0
).
boxed
(),
4
,
10
);
assertCountSum
(
IntStream
.
range
(
0
,
0
).
parallel
().
s
ubstream
(
0
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
0
,
0
).
parallel
().
s
kip
(
0
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
0
,
0
).
parallel
().
s
ubstream
(
4
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
0
,
0
).
parallel
().
s
kip
(
4
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
parallel
().
s
ubstream
(
4
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
parallel
().
s
kip
(
4
).
boxed
(),
0
,
0
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
parallel
().
s
ubstream
(
2
).
boxed
(),
2
,
7
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
parallel
().
s
kip
(
2
).
boxed
(),
2
,
7
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
parallel
().
s
ubstream
(
0
).
boxed
(),
4
,
10
);
assertCountSum
(
IntStream
.
range
(
1
,
5
).
parallel
().
s
kip
(
0
).
boxed
(),
4
,
10
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
s
ubstream
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
s
kip
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
s
ubstream
(
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
s
kip
(
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
2
).
toArray
(),
s
->
s
.
s
ubstream
(
0
),
IntStream
.
range
(
1
,
2
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
2
).
toArray
(),
s
->
s
.
s
kip
(
0
),
IntStream
.
range
(
1
,
2
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
2
).
toArray
(),
s
->
s
.
s
ubstream
(
1
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
2
).
toArray
(),
s
->
s
.
s
kip
(
1
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
s
ubstream
(
0
),
IntStream
.
range
(
1
,
101
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
s
kip
(
0
),
IntStream
.
range
(
1
,
101
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
s
ubstream
(
10
),
IntStream
.
range
(
11
,
101
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
s
kip
(
10
),
IntStream
.
range
(
11
,
101
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
s
ubstream
(
100
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
s
kip
(
100
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
s
ubstream
(
200
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
s
kip
(
200
),
EMPTY_INT_ARRAY
);
}
}
public
void
testLimit
()
{
public
void
testLimit
()
{
...
@@ -92,41 +92,23 @@ public class IntSliceOpTest extends OpTestCase {
...
@@ -92,41 +92,23 @@ public class IntSliceOpTest extends OpTestCase {
}
}
public
void
testSkipLimit
()
{
public
void
testSkipLimit
()
{
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
substream
(
0
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
skip
(
0
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
substream
(
0
).
limit
(
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
skip
(
0
).
limit
(
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
substream
(
10
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
skip
(
10
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
substream
(
10
).
limit
(
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
skip
(
10
).
limit
(
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
0
).
limit
(
100
),
IntStream
.
range
(
1
,
101
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
0
).
limit
(
100
),
IntStream
.
range
(
1
,
101
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
0
).
limit
(
10
),
IntStream
.
range
(
1
,
11
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
0
).
limit
(
10
),
IntStream
.
range
(
1
,
11
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
0
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
0
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
10
).
limit
(
100
),
IntStream
.
range
(
11
,
101
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
10
).
limit
(
100
),
IntStream
.
range
(
11
,
101
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
10
).
limit
(
10
),
IntStream
.
range
(
11
,
21
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
10
).
limit
(
10
),
IntStream
.
range
(
11
,
21
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
10
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
10
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
100
).
limit
(
100
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
100
).
limit
(
100
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
100
).
limit
(
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
100
).
limit
(
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
100
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
100
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
200
).
limit
(
100
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
200
).
limit
(
100
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
200
).
limit
(
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
200
).
limit
(
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
200
).
limit
(
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
skip
(
200
).
limit
(
0
),
EMPTY_INT_ARRAY
);
}
public
void
testSlice
()
{
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
substream
(
0
,
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
EMPTY_INT_ARRAY
,
s
->
s
.
substream
(
10
,
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
0
,
100
),
IntStream
.
range
(
1
,
101
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
0
,
10
),
IntStream
.
range
(
1
,
11
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
0
,
0
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
10
,
110
),
IntStream
.
range
(
11
,
101
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
10
,
20
),
IntStream
.
range
(
11
,
21
).
toArray
());
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
10
,
10
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
100
,
200
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
100
,
110
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
100
,
100
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
200
,
300
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
200
,
210
),
EMPTY_INT_ARRAY
);
exerciseOps
(
IntStream
.
range
(
1
,
101
).
toArray
(),
s
->
s
.
substream
(
200
,
200
),
EMPTY_INT_ARRAY
);
}
}
private
int
sliceSize
(
int
dataSize
,
int
skip
,
int
limit
)
{
private
int
sliceSize
(
int
dataSize
,
int
skip
,
int
limit
)
{
...
@@ -146,10 +128,10 @@ public class IntSliceOpTest extends OpTestCase {
...
@@ -146,10 +128,10 @@ public class IntSliceOpTest extends OpTestCase {
for
(
int
s
:
skips
)
{
for
(
int
s
:
skips
)
{
setContext
(
"skip"
,
s
);
setContext
(
"skip"
,
s
);
Collection
<
Integer
>
sr
=
exerciseOps
(
data
,
st
->
st
.
s
ubstream
(
s
));
Collection
<
Integer
>
sr
=
exerciseOps
(
data
,
st
->
st
.
s
kip
(
s
));
assertEquals
(
sr
.
size
(),
sliceSize
(
data
.
size
(),
s
));
assertEquals
(
sr
.
size
(),
sliceSize
(
data
.
size
(),
s
));
sr
=
exerciseOps
(
data
,
st
->
st
.
s
ubstream
(
s
).
substream
(
s
/
2
));
sr
=
exerciseOps
(
data
,
st
->
st
.
s
kip
(
s
).
skip
(
s
/
2
));
assertEquals
(
sr
.
size
(),
sliceSize
(
sliceSize
(
data
.
size
(),
s
),
s
/
2
));
assertEquals
(
sr
.
size
(),
sliceSize
(
sliceSize
(
data
.
size
(),
s
),
s
/
2
));
}
}
}
}
...
@@ -163,10 +145,10 @@ public class IntSliceOpTest extends OpTestCase {
...
@@ -163,10 +145,10 @@ public class IntSliceOpTest extends OpTestCase {
setContext
(
"skip"
,
s
);
setContext
(
"skip"
,
s
);
for
(
int
limit
:
limits
)
{
for
(
int
limit
:
limits
)
{
setContext
(
"limit"
,
limit
);
setContext
(
"limit"
,
limit
);
Collection
<
Integer
>
sr
=
exerciseOps
(
data
,
st
->
st
.
s
ubstream
(
s
).
limit
(
limit
));
Collection
<
Integer
>
sr
=
exerciseOps
(
data
,
st
->
st
.
s
kip
(
s
).
limit
(
limit
));
assertEquals
(
sr
.
size
(),
sliceSize
(
sliceSize
(
data
.
size
(),
s
),
0
,
limit
));
assertEquals
(
sr
.
size
(),
sliceSize
(
sliceSize
(
data
.
size
(),
s
),
0
,
limit
));
sr
=
exerciseOps
(
data
,
st
->
st
.
s
ubstream
(
s
,
limit
+
s
));
sr
=
exerciseOps
(
data
,
st
->
st
.
s
kip
(
s
).
limit
(
limit
));
assertEquals
(
sr
.
size
(),
sliceSize
(
data
.
size
(),
s
,
limit
));
assertEquals
(
sr
.
size
(),
sliceSize
(
data
.
size
(),
s
,
limit
));
}
}
}
}
...
@@ -204,7 +186,7 @@ public class IntSliceOpTest extends OpTestCase {
...
@@ -204,7 +186,7 @@ public class IntSliceOpTest extends OpTestCase {
}
}
public
void
testSkipParallel
()
{
public
void
testSkipParallel
()
{
int
[]
l
=
IntStream
.
range
(
1
,
1001
).
parallel
().
s
ubstream
(
200
).
limit
(
200
).
sequential
().
toArray
();
int
[]
l
=
IntStream
.
range
(
1
,
1001
).
parallel
().
s
kip
(
200
).
limit
(
200
).
sequential
().
toArray
();
assertEquals
(
l
.
length
,
200
);
assertEquals
(
l
.
length
,
200
);
assertEquals
(
l
[
l
.
length
-
1
],
400
);
assertEquals
(
l
[
l
.
length
-
1
],
400
);
}
}
...
...
test/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java
浏览文件 @
2b51fd83
...
@@ -50,27 +50,27 @@ import static java.util.stream.LambdaTestHelpers.*;
...
@@ -50,27 +50,27 @@ import static java.util.stream.LambdaTestHelpers.*;
public
class
SliceOpTest
extends
OpTestCase
{
public
class
SliceOpTest
extends
OpTestCase
{
public
void
testSkip
()
{
public
void
testSkip
()
{
assertCountSum
(
countTo
(
0
).
stream
().
s
ubstream
(
0
),
0
,
0
);
assertCountSum
(
countTo
(
0
).
stream
().
s
kip
(
0
),
0
,
0
);
assertCountSum
(
countTo
(
0
).
stream
().
s
ubstream
(
4
),
0
,
0
);
assertCountSum
(
countTo
(
0
).
stream
().
s
kip
(
4
),
0
,
0
);
assertCountSum
(
countTo
(
4
).
stream
().
s
ubstream
(
4
),
0
,
0
);
assertCountSum
(
countTo
(
4
).
stream
().
s
kip
(
4
),
0
,
0
);
assertCountSum
(
countTo
(
4
).
stream
().
s
ubstream
(
2
),
2
,
7
);
assertCountSum
(
countTo
(
4
).
stream
().
s
kip
(
2
),
2
,
7
);
assertCountSum
(
countTo
(
4
).
stream
().
s
ubstream
(
0
),
4
,
10
);
assertCountSum
(
countTo
(
4
).
stream
().
s
kip
(
0
),
4
,
10
);
assertCountSum
(
countTo
(
0
).
parallelStream
().
s
ubstream
(
0
),
0
,
0
);
assertCountSum
(
countTo
(
0
).
parallelStream
().
s
kip
(
0
),
0
,
0
);
assertCountSum
(
countTo
(
0
).
parallelStream
().
s
ubstream
(
4
),
0
,
0
);
assertCountSum
(
countTo
(
0
).
parallelStream
().
s
kip
(
4
),
0
,
0
);
assertCountSum
(
countTo
(
4
).
parallelStream
().
s
ubstream
(
4
),
0
,
0
);
assertCountSum
(
countTo
(
4
).
parallelStream
().
s
kip
(
4
),
0
,
0
);
assertCountSum
(
countTo
(
4
).
parallelStream
().
s
ubstream
(
2
),
2
,
7
);
assertCountSum
(
countTo
(
4
).
parallelStream
().
s
kip
(
2
),
2
,
7
);
assertCountSum
(
countTo
(
4
).
parallelStream
().
s
ubstream
(
0
),
4
,
10
);
assertCountSum
(
countTo
(
4
).
parallelStream
().
s
kip
(
0
),
4
,
10
);
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
ubstream
(
0
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
kip
(
0
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
ubstream
(
10
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
kip
(
10
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
1
),
s
->
s
.
s
ubstream
(
0
),
countTo
(
1
));
exerciseOps
(
countTo
(
1
),
s
->
s
.
s
kip
(
0
),
countTo
(
1
));
exerciseOps
(
countTo
(
1
),
s
->
s
.
s
ubstream
(
1
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
1
),
s
->
s
.
s
kip
(
1
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
0
),
countTo
(
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
0
),
countTo
(
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
10
),
range
(
11
,
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
10
),
range
(
11
,
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
100
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
100
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
200
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
200
),
Collections
.
emptyList
());
}
}
public
void
testLimit
()
{
public
void
testLimit
()
{
...
@@ -97,43 +97,43 @@ public class SliceOpTest extends OpTestCase {
...
@@ -97,43 +97,43 @@ public class SliceOpTest extends OpTestCase {
}
}
public
void
testSkipLimit
()
{
public
void
testSkipLimit
()
{
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
ubstream
(
0
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
kip
(
0
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
ubstream
(
0
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
kip
(
0
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
ubstream
(
10
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
kip
(
10
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
ubstream
(
10
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
kip
(
10
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
0
).
limit
(
100
),
countTo
(
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
0
).
limit
(
100
),
countTo
(
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
0
).
limit
(
10
),
countTo
(
10
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
0
).
limit
(
10
),
countTo
(
10
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
0
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
0
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
10
).
limit
(
100
),
range
(
11
,
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
10
).
limit
(
100
),
range
(
11
,
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
10
).
limit
(
10
),
range
(
11
,
20
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
10
).
limit
(
10
),
range
(
11
,
20
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
10
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
10
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
100
).
limit
(
100
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
100
).
limit
(
100
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
100
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
100
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
100
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
100
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
200
).
limit
(
100
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
200
).
limit
(
100
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
200
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
200
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
200
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
200
).
limit
(
0
),
Collections
.
emptyList
());
}
}
public
void
testSlice
()
{
public
void
testSlice
()
{
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
ubstream
(
0
,
0
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
kip
(
0
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
ubstream
(
0
,
10
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
kip
(
0
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
ubstream
(
10
,
10
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
kip
(
10
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
ubstream
(
10
,
20
),
Collections
.
emptyList
());
exerciseOps
(
Collections
.
emptyList
(),
s
->
s
.
s
kip
(
10
).
limit
(
20
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
0
,
100
),
countTo
(
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
0
).
limit
(
100
),
countTo
(
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
0
,
10
),
countTo
(
10
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
0
).
limit
(
10
),
countTo
(
10
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
0
,
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
0
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
10
,
11
0
),
range
(
11
,
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
10
).
limit
(
10
0
),
range
(
11
,
100
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
10
,
2
0
),
range
(
11
,
20
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
10
).
limit
(
1
0
),
range
(
11
,
20
));
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
10
,
1
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
10
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
100
,
2
00
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
100
).
limit
(
1
00
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
100
,
1
10
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
100
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
100
,
10
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
100
).
limit
(
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
200
,
3
00
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
200
).
limit
(
1
00
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
200
,
2
10
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
200
).
limit
(
10
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
ubstream
(
200
,
20
0
),
Collections
.
emptyList
());
exerciseOps
(
countTo
(
100
),
s
->
s
.
s
kip
(
200
).
limit
(
0
),
Collections
.
emptyList
());
}
}
private
int
sliceSize
(
int
dataSize
,
int
skip
,
int
limit
)
{
private
int
sliceSize
(
int
dataSize
,
int
skip
,
int
limit
)
{
...
@@ -156,17 +156,17 @@ public class SliceOpTest extends OpTestCase {
...
@@ -156,17 +156,17 @@ public class SliceOpTest extends OpTestCase {
setContext
(
"skip"
,
s
);
setContext
(
"skip"
,
s
);
testSliceMulti
(
data
,
testSliceMulti
(
data
,
sliceSize
(
data
.
size
(),
s
),
sliceSize
(
data
.
size
(),
s
),
st
->
st
.
s
ubstream
(
s
),
st
->
st
.
s
kip
(
s
),
st
->
st
.
s
ubstream
(
s
),
st
->
st
.
s
kip
(
s
),
st
->
st
.
s
ubstream
(
s
),
st
->
st
.
s
kip
(
s
),
st
->
st
.
s
ubstream
(
s
));
st
->
st
.
s
kip
(
s
));
testSliceMulti
(
data
,
testSliceMulti
(
data
,
sliceSize
(
sliceSize
(
data
.
size
(),
s
),
s
/
2
),
sliceSize
(
sliceSize
(
data
.
size
(),
s
),
s
/
2
),
st
->
st
.
s
ubstream
(
s
).
substream
(
s
/
2
),
st
->
st
.
s
kip
(
s
).
skip
(
s
/
2
),
st
->
st
.
s
ubstream
(
s
).
substream
(
s
/
2
),
st
->
st
.
s
kip
(
s
).
skip
(
s
/
2
),
st
->
st
.
s
ubstream
(
s
).
substream
(
s
/
2
),
st
->
st
.
s
kip
(
s
).
skip
(
s
/
2
),
st
->
st
.
s
ubstream
(
s
).
substream
(
s
/
2
));
st
->
st
.
s
kip
(
s
).
skip
(
s
/
2
));
}
}
}
}
...
@@ -182,17 +182,10 @@ public class SliceOpTest extends OpTestCase {
...
@@ -182,17 +182,10 @@ public class SliceOpTest extends OpTestCase {
setContext
(
"limit"
,
l
);
setContext
(
"limit"
,
l
);
testSliceMulti
(
data
,
testSliceMulti
(
data
,
sliceSize
(
sliceSize
(
data
.
size
(),
s
),
0
,
l
),
sliceSize
(
sliceSize
(
data
.
size
(),
s
),
0
,
l
),
st
->
st
.
substream
(
s
).
limit
(
l
),
st
->
st
.
skip
(
s
).
limit
(
l
),
st
->
st
.
substream
(
s
).
limit
(
l
),
st
->
st
.
skip
(
s
).
limit
(
l
),
st
->
st
.
substream
(
s
).
limit
(
l
),
st
->
st
.
skip
(
s
).
limit
(
l
),
st
->
st
.
substream
(
s
).
limit
(
l
));
st
->
st
.
skip
(
s
).
limit
(
l
));
testSliceMulti
(
data
,
sliceSize
(
data
.
size
(),
s
,
l
),
st
->
st
.
substream
(
s
,
l
+
s
),
st
->
st
.
substream
(
s
,
l
+
s
),
st
->
st
.
substream
(
s
,
l
+
s
),
st
->
st
.
substream
(
s
,
l
+
s
));
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录