builder ( )源码实例Demo

java.util.stream.IntStream#builder ( )源码实例Demo

下面列出了java.util.stream.IntStream#builder ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: termd   文件: Readline.java
private void refresh(LineBuffer update, int width) {
  LineBuffer copy3 = new LineBuffer();
  IntStream.Builder consumer = IntStream.builder();
  copy3.insert(Helper.toCodePoints(currentPrompt));
  copy3.insert(buffer().toArray());
  copy3.setCursor(currentPrompt.length() + buffer().getCursor());
  LineBuffer copy2 = new LineBuffer();
  copy2.insert(Helper.toCodePoints(currentPrompt));
  copy2.insert(update.toArray());
  copy2.setCursor(currentPrompt.length() + update.getCursor());
  copy3.update(copy2, data -> {
    for (int cp : data) {
      consumer.accept(cp);
    }
  }, width);
  conn.stdoutHandler().accept(consumer.build().toArray());
  buffer.clear();
  buffer.insert(update.toArray());
  buffer.setCursor(update.getCursor());
}
 
源代码2 项目: dragonwell8_jdk   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码3 项目: TencentKona-8   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码4 项目: jdk8u60   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码5 项目: openjdk-jdk8u   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码6 项目: adventure   文件: TagStringReader.java
private int[] intArray() throws StringTagParseException {
  final IntStream.Builder builder = IntStream.builder();
  while(this.buffer.hasMore()) {
    final BinaryTag value = this.tag();
    if(!(value instanceof IntBinaryTag)) {
      throw this.buffer.makeError("All elements of an int array must be ints!");
    }
    builder.add(((IntBinaryTag) value).intValue());
    if(this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
      return builder.build().toArray();
    }
  }
  throw this.buffer.makeError("Reached end of document without array close");
}
 
源代码7 项目: openjdk-jdk8u-backup   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码8 项目: openjdk-jdk9   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码9 项目: jdk8u-jdk   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码10 项目: hottub   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码11 项目: openjdk-8-source   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码12 项目: ViaVersion   文件: TagStringReader.java
private int[] intArray() throws StringTagParseException {
    final IntStream.Builder builder = IntStream.builder();
    while (this.buffer.hasMore()) {
        final Tag value = this.tag();
        if (!(value instanceof IntTag)) {
            throw this.buffer.makeError("All elements of an int array must be ints!");
        }
        builder.add(((IntTag) value).getValue());
        if (this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
            return builder.build().toArray();
        }
    }
    throw this.buffer.makeError("Reached end of document without array close");
}
 
源代码13 项目: openjdk-8   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码14 项目: jdk8u_jdk   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码15 项目: streams-utils   文件: RollingOfIntSpliterator.java
private IntStream buildSubstream() {

		IntStream.Builder subBuilder = IntStream.builder() ;
		for (int i = 0 ; i < grouping ; i++) {
			subBuilder.add(buffer[(i + bufferReadIndex.get()) % buffer.length]) ;
		}
		bufferReadIndex.incrementAndGet() ;
		return subBuilder.build() ;
	}
 
源代码16 项目: streamex   文件: EmitterSpliterator.java
@Override
public void accept(int t) {
    if ((vals += vals < 3 ? 1 : 0) == 2) {
        cons = IntStream.builder();
    }
    cons.accept(t);
}
 
源代码17 项目: streamex   文件: IntStreamExTest.java
@Test
public void testDropWhile() {
    assertArrayEquals(new int[] { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, IntStreamEx.range(100).dropWhile(
        i -> i % 10 < 5).limit(10).toArray());
    assertEquals(100, IntStreamEx.range(100).dropWhile(i -> i % 10 < 0).count());
    assertEquals(0, IntStreamEx.range(100).dropWhile(i -> i % 10 < 10).count());
    assertEquals(OptionalInt.of(0), IntStreamEx.range(100).dropWhile(i -> i % 10 < 0).findFirst());
    assertEquals(OptionalInt.empty(), IntStreamEx.range(100).dropWhile(i -> i % 10 < 10).findFirst());

    java.util.Spliterator.OfInt spltr = IntStreamEx.range(100).dropWhile(i -> i % 10 < 1).spliterator();
    assertTrue(spltr.tryAdvance((int x) -> assertEquals(1, x)));
    Builder builder = IntStream.builder();
    spltr.forEachRemaining(builder);
    assertArrayEquals(IntStreamEx.range(2, 100).toArray(), builder.build().toArray());
}
 
源代码18 项目: jdk8u-jdk   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码19 项目: jdk8u-dev-jdk   文件: StreamBuilderTest.java
@Test(dataProvider = "sizes")
public void testIntAfterBuilding(int size) {
    IntStream.Builder sb = IntStream.builder();
    IntStream.range(0, size).forEach(sb);
    sb.build();

    checkISE(() -> sb.accept(1));
    checkISE(() -> sb.add(1));
    checkISE(() -> sb.build());
}
 
源代码20 项目: paleo   文件: IntColumn.java
private Builder(IntColumnId id) {
    this.id = id;
    this.valueBuilder = IntStream.builder();
    this.metaDataBuilder = new MetaDataBuilder();
}
 
源代码评论
动弹
沙发等你来抢
 方法所在类