public PrimitiveIterator.OfLong primitiveIterator() { return inner.iterator(); }
@Override public PrimitiveIterator.OfLong execute() { try (final LongStream stream = buildPrevious()) { return stream.iterator(); } } }
return LongStream.of( (long[]) o ).iterator();
default PrimitiveIterator.OfLong iterator(LongPipeline pipeline) { requireNonNull(pipeline); return optimize(pipeline).getAsLongStream().iterator(); }
return ((LongStream) iterable).iterator();
@Override public PrimitiveIterator.OfLong iterator() { if (isAllowStreamIteratorAndSpliterator()) { return stream().iterator(); } throw newUnsupportedException("iterator"); }
/** Broadcast the trace events to all of the policy actors. */ private void broadcast() { try (LongStream events = eventStream()) { LongArrayList batch = new LongArrayList(batchSize); for (PrimitiveIterator.OfLong i = events.iterator(); i.hasNext();) { batch.add(i.nextLong()); if (batch.size() == batchSize) { router.route(batch, self()); batch = new LongArrayList(batchSize); } } router.route(batch, self()); router.route(FINISH, self()); } catch (Exception e) { context().system().log().error(e, ""); context().stop(self()); } }
public PrimitiveIterator.OfLong primitiveIterator() { return inner.iterator(); }
static LongUnaryOperator factorial = x -> x == 0 ? 1 : x * factorial.applyAsLong(x - 1); public static void main(String[] args) { LongStream ls = LongStream.iterate(0, i -> i + 1).map(factorial); OfLong it = ls.iterator(); long next = 0; while ((next = it.nextLong()) <= 1000) System.out.println(next); }
@Override public OfLong iterator() { // This is a terminal operation return evalAndclose(() -> stream.iterator()); }
RandomExpirationSupplier(Supplier<T> delegate, long minDuration, long maxDuration, TimeUnit timeUnit) { checkArgument(minDuration >= 0, "minDuration cannot be negative"); checkArgument(maxDuration > minDuration, "maxDuration must be greater than minDuration"); checkNotNull(delegate, "delegate"); checkNotNull(timeUnit, "timeUnit"); long minDurationNanos = timeUnit.toNanos(minDuration); long maxDurationNanos = timeUnit.toNanos(maxDuration); _delegate = delegate; _nanosDurations = new Random().longs(minDurationNanos, maxDurationNanos).iterator(); }
RandomExpirationSupplier(Supplier<T> delegate, long minDuration, long maxDuration, TimeUnit timeUnit) { checkArgument(minDuration >= 0, "minDuration cannot be negative"); checkArgument(maxDuration > minDuration, "maxDuration must be greater than minDuration"); checkNotNull(delegate, "delegate"); checkNotNull(timeUnit, "timeUnit"); long minDurationNanos = timeUnit.toNanos(minDuration); long maxDurationNanos = timeUnit.toNanos(maxDuration); _delegate = delegate; _nanosDurations = new Random().longs(minDurationNanos, maxDurationNanos).iterator(); }
default PrimitiveIterator.OfLong iterator(LongPipeline pipeline) { requireNonNull(pipeline); return optimize(pipeline).getAsLongStream().iterator(); }
@Override protected boolean matchesSafely(LongStream actual) { return remainingItemsEqual(new LongArrayIterator(expected), actual.limit(expected.length).iterator()); } };
@Override public PrimitiveIterator.OfLong iterator() { if (isAllowStreamIteratorAndSpliterator()) { return stream().iterator(); } throw newUnsupportedException("iterator"); }
private Location[] getTwoNodes(final PackedAtlas packedAtlas, final long size) { final OfLong iterator = this.random.longs(0, size).iterator(); final long index1 = iterator.next(); final long index2 = iterator.next(); final Location[] result = new Location[2]; result[0] = packedAtlas.nodeLocation(index1); result[1] = packedAtlas.nodeLocation(index2); return result; } }
@ValueSource(ints = {1, 2, 3, 4, 11}) @ParameterizedTest(name = "multipleOverlappingUnionWithInnerLimits() [{0}]") public void multipleOverlappingUnionWithInnerLimits(int innerLimit) throws Exception { verifyUnionWithInnerLimits(Arrays.asList( cont -> scanRecordsBetween(10L, 20L, cont).limitRowsTo(innerLimit) .map(rec -> (FDBRecord<Message>) rec), cont -> scanRecordsBetween(9L, 15L, cont).limitRowsTo(innerLimit) .map(rec -> (FDBRecord<Message>) rec), cont -> scanRecordsBetween(14L, 25L, cont).limitRowsTo(innerLimit) .map(rec -> (FDBRecord<Message>) rec) ), LongStream.range(9L, 25L).iterator()); }
@ValueSource(ints = {1, 2, 3}) @ParameterizedTest(name = "overlappingUnionWithInnerLimits() [{0}]") public void overlappingUnionWithInnerLimits(int innerLimit) throws Exception { verifyUnionWithInnerLimits(cont -> scanRecordsBetween(10L, 53L, cont).limitRowsTo(innerLimit) .map(rec -> (FDBRecord<Message>) rec), cont -> scanRecordsBetween(50L, 62L, cont).limitRowsTo(innerLimit) .map(rec -> (FDBRecord<Message>) rec), LongStream.range(10L, 62L).iterator()); }
@ValueSource(ints = {1, 2, 3}) @ParameterizedTest(name = "disjointUnionWithInnerLimits() [{0}]") public void disjointUnionWithInnerLimits(int innerLimit) throws Exception { verifyUnionWithInnerLimits(cont -> scanRecordsBetween(10L, 22L, cont).limitRowsTo(innerLimit) .map(rec -> (FDBRecord<Message>) rec), cont -> scanRecordsBetween(50L, 62L, cont).limitRowsTo(innerLimit) .map(rec -> (FDBRecord<Message>) rec), LongStream.concat(LongStream.range(10L, 22L), LongStream.range(50L, 62L)).iterator()); }