当前位置: 首页>>代码示例>>Java>>正文


Java SpliteratorTester类代码示例

本文整理汇总了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");
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:CollectSpliteratorsTest.java

示例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');
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:11,代码来源:CollectSpliteratorsTest.java

示例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");
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:11,代码来源:StreamsTest.java

示例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");
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:16,代码来源:StreamsTest.java

示例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");
}
 
开发者ID:google,项目名称:guava,代码行数:8,代码来源:CollectSpliteratorsTest.java

示例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');
}
 
开发者ID:google,项目名称:guava,代码行数:11,代码来源:CollectSpliteratorsTest.java

示例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");
}
 
开发者ID:google,项目名称:guava,代码行数:8,代码来源:StreamsTest.java

示例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());
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:7,代码来源:CollectionSpliteratorTester.java

示例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();
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:7,代码来源:CollectionSpliteratorTester.java

示例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");
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:6,代码来源:StreamsTest.java

示例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");
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:6,代码来源:StreamsTest.java

示例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");
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:7,代码来源:StreamsTest.java


注:本文中的com.google.common.collect.testing.SpliteratorTester类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。