本文整理汇总了Java中com.google.common.collect.testing.SpliteratorTester类的典型用法代码示例。如果您正苦于以下问题:Java SpliteratorTester类的具体用法?Java SpliteratorTester怎么用?Java SpliteratorTester使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SpliteratorTester类属于com.google.common.collect.testing包,在下文中一共展示了SpliteratorTester类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMap
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
public void testMap() {
SpliteratorTester.of(
()
-> CollectSpliterators.map(
Arrays.spliterator(new String[] {"a", "b", "c", "d", "e"}), Ascii::toUpperCase))
.expect("A", "B", "C", "D", "E");
}
示例2: testFlatMap
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
public void testFlatMap() {
SpliteratorTester.of(
()
-> CollectSpliterators.flatMap(
Arrays.spliterator(new String[] {"abc", "", "de", "f", "g", ""}),
(String str) -> Lists.charactersOf(str).spliterator(),
Spliterator.SIZED | Spliterator.DISTINCT | Spliterator.NONNULL,
7))
.expect('a', 'b', 'c', 'd', 'e', 'f', 'g');
}
示例3: testConcat_refStream
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
public void testConcat_refStream() {
assertThat(Streams.concat(Stream.of("a"), Stream.of("b"), Stream.empty(), Stream.of("c", "d")))
.containsExactly("a", "b", "c", "d")
.inOrder();
SpliteratorTester.of(
() ->
Streams.concat(Stream.of("a"), Stream.of("b"), Stream.empty(), Stream.of("c", "d"))
.spliterator())
.expect("a", "b", "c", "d");
}
示例4: testMapWithIndex
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
private void testMapWithIndex(Function<Collection<String>, Stream<String>> collectionImpl) {
SpliteratorTester.of(
() ->
Streams.mapWithIndex(
collectionImpl.apply(ImmutableList.of()), (str, i) -> str + ":" + i)
.spliterator())
.expect(ImmutableList.of());
SpliteratorTester.of(
() ->
Streams.mapWithIndex(
collectionImpl.apply(ImmutableList.of("a", "b", "c", "d", "e")),
(str, i) -> str + ":" + i)
.spliterator())
.expect("a:0", "b:1", "c:2", "d:3", "e:4");
}
示例5: testMap
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
public void testMap() {
SpliteratorTester.of(
() ->
CollectSpliterators.map(
Arrays.spliterator(new String[] {"a", "b", "c", "d", "e"}), Ascii::toUpperCase))
.expect("A", "B", "C", "D", "E");
}
示例6: testFlatMap
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
public void testFlatMap() {
SpliteratorTester.of(
() ->
CollectSpliterators.flatMap(
Arrays.spliterator(new String[] {"abc", "", "de", "f", "g", ""}),
(String str) -> Lists.charactersOf(str).spliterator(),
Spliterator.SIZED | Spliterator.DISTINCT | Spliterator.NONNULL,
7))
.expect('a', 'b', 'c', 'd', 'e', 'f', 'g');
}
示例7: TODO
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
@GwtIncompatible // TODO(b/38490623): reenable after GWT double-to-string conversion is fixed
public void testMapWithIndex_doubleStream() {
SpliteratorTester.of(
() ->
Streams.mapWithIndex(DoubleStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
.expect("0.0:0", "1.0:1", "2.0:2");
}
示例8: testSpliteratorUnknownOrder
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
@CollectionFeature.Require(absent = KNOWN_ORDER)
public void testSpliteratorUnknownOrder() {
synchronized (collection) {
SpliteratorTester.of(collection::spliterator).expect(getSampleElements());
}
}
示例9: testSpliteratorKnownOrder
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
@CollectionFeature.Require(KNOWN_ORDER)
public void testSpliteratorKnownOrder() {
synchronized (collection) {
SpliteratorTester.of(collection::spliterator).expect(getOrderedElements()).inOrder();
}
}
示例10: testMapWithIndex_intStream
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
public void testMapWithIndex_intStream() {
SpliteratorTester.of(
() -> Streams.mapWithIndex(IntStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
.expect("0:0", "1:1", "2:2");
}
示例11: testMapWithIndex_longStream
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
public void testMapWithIndex_longStream() {
SpliteratorTester.of(
() -> Streams.mapWithIndex(LongStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
.expect("0:0", "1:1", "2:2");
}
示例12: testMapWithIndex_doubleStream
import com.google.common.collect.testing.SpliteratorTester; //导入依赖的package包/类
public void testMapWithIndex_doubleStream() {
SpliteratorTester.of(
() ->
Streams.mapWithIndex(DoubleStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
.expect("0.0:0", "1.0:1", "2.0:2");
}