public class Closeables extends Object
| Modifier and Type | Method and Description | 
|---|---|
static <E> CloseableIterator<E> | 
iterator(Iterator<? extends E> iterator)
Creates a closeable iterator from the given iterator that does nothing when close is called. 
 | 
static <R> CloseableIterator<R> | 
iterator(Stream<? extends R> stream)
Creates a closeable iterator that when closed will close the underlying stream as well 
 | 
static <E> CloseableSpliterator<E> | 
spliterator(CloseableIterator<? extends E> iterator,
           long size,
           int characteristics)
Takes a provided closeable iterator and wraps it appropriately so it can be used as a closeable spliterator that
 will close the iterator when the spliterator is closed. 
 | 
static <T> CloseableSpliterator<T> | 
spliterator(Spliterator<T> spliterator)
Creates a closeable spliterator from the given spliterator that does nothing when close is called. 
 | 
static <R> CloseableSpliterator<R> | 
spliterator(Stream<R> stream)
Creates a closeable spliterator that when closed will close the underlying stream as well 
 | 
static <E> Stream<E> | 
stream(CloseableIterator<E> iterator,
      boolean parallel,
      long size,
      int characteristics)
Creates a stream that when closed will also close the underlying iterator 
 | 
static <E> Stream<E> | 
stream(CloseableSpliterator<E> spliterator,
      boolean parallel)
Creates a stream that when closed will also close the underlying spliterator 
 | 
public static <E> CloseableSpliterator<E> spliterator(CloseableIterator<? extends E> iterator, long size, int characteristics)
E - The type that is the same between the iterator and spliteratoriterator - The closeable iterator to change to a spliteratorsize - The approximate size of the iterator.  If no size is known Long.MAX_VALUE should be passedcharacteristics - The characteristics of the given spliterator as defined on the Spliterator
                        interfacepublic static <T> CloseableSpliterator<T> spliterator(Spliterator<T> spliterator)
T - The type of the spliteratorsspliterator - The spliterator to wrap to allow it to become a closeable spliterator.public static <R> CloseableSpliterator<R> spliterator(Stream<R> stream)
R - The type of the streamstream - The stream to change into a closeable spliteratorpublic static <R> CloseableIterator<R> iterator(Stream<? extends R> stream)
R - The type of the streamstream - The stream to change into a closeable iteratorpublic static <E> CloseableIterator<E> iterator(Iterator<? extends E> iterator)
E - The type of the iteratorsiterator - The iterator to wrap to allow it to become a closeable iteratorpublic static <E> Stream<E> stream(CloseableSpliterator<E> spliterator, boolean parallel)
E - the type of the streamspliterator - spliterator to back the stream and subsequently closeparallel - whether or not the returned stream is parallel or notpublic static <E> Stream<E> stream(CloseableIterator<E> iterator, boolean parallel, long size, int characteristics)
E - the type of the streamiterator - iterator to back the stream and subsequently closeparallel - whether or not the returned stream is parallel or notsize - the size of the iterator if known, otherwise Long.MAX_VALUE should be passed.characteristics - the characteristics of the iterator to be usedCopyright © 2018 JBoss, a division of Red Hat. All rights reserved.