當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。