use of java.util.stream.IntStream.Builder in project streamex by amaembo.
the class IntStreamExTest method testDropWhile.
@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());
}
use of java.util.stream.IntStream.Builder in project servoy-client by Servoy.
the class RelatedFoundSet method getIndexesEqualsEntries.
private int[] getIndexesEqualsEntries() {
if (equalsOpsIndexes == null) {
Relation relation = fsm.getApplication().getFlattenedSolution().getRelation(relationName);
Builder indexBuilder = IntStream.builder();
int[] operators = relation.getOperators();
for (int i = 0; i < operators.length; i++) {
if (operators[i] == IBaseSQLCondition.EQUALS_OPERATOR) {
indexBuilder.add(i);
}
}
equalsOpsIndexes = indexBuilder.build().toArray();
}
return equalsOpsIndexes;
}
use of java.util.stream.IntStream.Builder in project deephaven-core by deephaven.
the class Column method getRequiredColumns.
public IntStream getRequiredColumns() {
Builder builder = IntStream.builder();
builder.accept(index);
if (formatStringColumnIndex != null) {
builder.accept(formatStringColumnIndex);
}
if (styleColumnIndex != null) {
builder.accept(styleColumnIndex);
}
return builder.build();
}
Aggregations