use of java.util.Spliterator.OfInt in project openj9 by eclipse.
the class StringStreams method testStringCharsSpliteratorSplittingAfterIterating.
/**
* Consume a bit of the spliterator, then split it.
*/
@Test
public void testStringCharsSpliteratorSplittingAfterIterating() {
OfInt s = DIGITS.chars().spliterator();
ArrayList<OfInt> sArray = new ArrayList<>();
final HashSet<Integer> actualIntegers = new HashSet<>();
IntConsumer consumer = (IntConsumer) i -> actualIntegers.add(Integer.valueOf(i));
while (Objects.nonNull(s)) {
s.tryAdvance(consumer);
sArray.add(s);
s = s.trySplit();
}
for (OfInt e : sArray) {
e.forEachRemaining(consumer);
}
checkDigits(actualIntegers);
}
use of java.util.Spliterator.OfInt in project openj9 by eclipse-openj9.
the class StringStreams method testStringCharsSpliteratorSplitting.
@Test
public void testStringCharsSpliteratorSplitting() {
OfInt s = DIGITS.chars().spliterator();
ArrayList<OfInt> sArray = new ArrayList<>();
while (Objects.nonNull(s)) {
sArray.add(s);
s = s.trySplit();
}
final HashSet<Integer> actualIntegers = new HashSet<>();
for (OfInt e : sArray) {
e.forEachRemaining((IntConsumer) i -> actualIntegers.add(Integer.valueOf(i)));
}
checkDigits(actualIntegers);
}
use of java.util.Spliterator.OfInt in project openj9 by eclipse-openj9.
the class StringStreams method testStringCharsSpliteratorSplittingAfterIterating.
/**
* Consume a bit of the spliterator, then split it.
*/
@Test
public void testStringCharsSpliteratorSplittingAfterIterating() {
OfInt s = DIGITS.chars().spliterator();
ArrayList<OfInt> sArray = new ArrayList<>();
final HashSet<Integer> actualIntegers = new HashSet<>();
IntConsumer consumer = (IntConsumer) i -> actualIntegers.add(Integer.valueOf(i));
while (Objects.nonNull(s)) {
s.tryAdvance(consumer);
sArray.add(s);
s = s.trySplit();
}
for (OfInt e : sArray) {
e.forEachRemaining(consumer);
}
checkDigits(actualIntegers);
}
use of java.util.Spliterator.OfInt in project openj9 by eclipse.
the class StringStreams method testStringCharsSpliteratorSplitting.
@Test
public void testStringCharsSpliteratorSplitting() {
OfInt s = DIGITS.chars().spliterator();
ArrayList<OfInt> sArray = new ArrayList<>();
while (Objects.nonNull(s)) {
sArray.add(s);
s = s.trySplit();
}
final HashSet<Integer> actualIntegers = new HashSet<>();
for (OfInt e : sArray) {
e.forEachRemaining((IntConsumer) i -> actualIntegers.add(Integer.valueOf(i)));
}
checkDigits(actualIntegers);
}
Aggregations