Example usage for java.util Spliterator estimateSize

List of usage examples for java.util Spliterator estimateSize

Introduction

In this page you can find the example usage for java.util Spliterator estimateSize.

Prototype

long estimateSize();

Source Link

Document

Returns an estimate of the number of elements that would be encountered by a #forEachRemaining traversal, or returns Long#MAX_VALUE if infinite, unknown, or too expensive to compute.

Usage

From source file:com.wrmsr.kleist.util.Itertools.java

public static <T> Spliterator<EnumeratedElement<T>> enumerate(Spliterator<T> spliterator) {
    int characteristics = spliterator.characteristics() | Spliterator.NONNULL & ~Spliterator.CONCURRENT;
    return Spliterators.spliterator(enumerate(Spliterators.iterator(spliterator)), spliterator.estimateSize(),
            characteristics);/*from  w  w  w. ja v a2s.  c  o  m*/
}