@Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } currentCount.incrementAndGet(); return wrappedIterator.next(); }
@Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } currentCount.incrementAndGet(); return wrappedIterator.next(); }
@Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } currentCount.incrementAndGet(); return wrappedIterator.next(); }
@Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } currentCount.incrementAndGet(); return wrappedIterator.next(); }
@Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } currentCount.incrementAndGet(); return wrappedIterator.next(); }
/** * Returns an unmodifiable list of all elements in the provided iterator. * The iterator is guaranteed to be closed after its execution. * * @param iterator the provided iterator. * @param <V> the type of elements in the iterator * @return a list of all elements returned by the iterator */ static <V> List<V> toList(ClosableIterator<V> iterator) { Preconditions.checkNotNull(iterator); List<V> values = new ArrayList<>(); try { while (iterator.hasNext()) { values.add(iterator.next()); } } finally { iterator.close(); } return Collections.unmodifiableList(values); }
/** * Returns an unmodifiable list of all elements in the provided iterator. * The iterator is guaranteed to be closed after its execution. * * @param iterator the provided iterator. * @param <V> the type of elements in the iterator * @return a list of all elements returned by the iterator */ static <V> List<V> toList(ClosableIterator<V> iterator) { Preconditions.checkNotNull(iterator); List<V> values = new ArrayList<>(); try { while (iterator.hasNext()) { values.add(iterator.next()); } } finally { iterator.close(); } return Collections.unmodifiableList(values); }
/** * Returns an unmodifiable list of all elements in the provided iterator. * The iterator is guaranteed to be closed after its execution. * * @param iterator the provided iterator. * @param <V> the type of elements in the iterator * @return a list of all elements returned by the iterator */ static <V> List<V> toList(ClosableIterator<V> iterator) { Preconditions.checkNotNull(iterator); List<V> values = new ArrayList<>(); try { while (iterator.hasNext()) { values.add(iterator.next()); } } finally { iterator.close(); } return Collections.unmodifiableList(values); }
/** * Returns an unmodifiable list of all elements in the provided iterator. * The iterator is guaranteed to be closed after its execution. * * @param iterator the provided iterator. * @param <V> the type of elements in the iterator * @return a list of all elements returned by the iterator */ static <V> List<V> toList(ClosableIterator<V> iterator) { Preconditions.checkNotNull(iterator); List<V> values = new ArrayList<>(); try { while (iterator.hasNext()) { values.add(iterator.next()); } } finally { iterator.close(); } return Collections.unmodifiableList(values); }
/** * Returns an unmodifiable list of all elements in the provided iterator. * The iterator is guaranteed to be closed after its execution. * * @param iterator the provided iterator. * @param <V> the type of elements in the iterator * @return a list of all elements returned by the iterator */ static <V> List<V> toList(ClosableIterator<V> iterator) { Preconditions.checkNotNull(iterator); List<V> values = new ArrayList<>(); try { while (iterator.hasNext()) { values.add(iterator.next()); } } finally { iterator.close(); } return Collections.unmodifiableList(values); }
private static <K, V> List<TimestampedValue<V>> readStore( TimeSeriesStore<K, V> store, K key, long startTimestamp, long endTimestamp) { List<TimestampedValue<V>> list = new ArrayList<>(); ClosableIterator<TimestampedValue<V>> storeValuesIterator = store.get(key, startTimestamp, endTimestamp); while (storeValuesIterator.hasNext()) { TimestampedValue<V> next = storeValuesIterator.next(); list.add(next); } storeValuesIterator.close(); return list; }