Class BlockingIterables
- java.lang.Object
-
- io.servicetalk.concurrent.internal.BlockingIterables
-
public final class BlockingIterables extends java.lang.Object
Utility methods forBlockingIterable
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> BlockingIterable<T>
emptyBlockingIterable()
static <T> BlockingIterable<T>
from(CloseableIterable<T> iterable)
Convert from aIterable
to aCloseableIterable
.static <T> BlockingIterable<T>
from(java.lang.Iterable<T> iterable)
Convert from aIterable
to aBlockingIterable
.static <T> BlockingIterable<T>
singletonBlockingIterable(T item)
-
-
-
Method Detail
-
emptyBlockingIterable
public static <T> BlockingIterable<T> emptyBlockingIterable()
- Type Parameters:
T
- The type of items for theBlockingIterable
.- Returns:
- a
BlockingIterable
that generatesBlockingIterator
s whereIterator.hasNext()
returnstrue
.
-
singletonBlockingIterable
public static <T> BlockingIterable<T> singletonBlockingIterable(T item)
- Type Parameters:
T
- The type of items for theBlockingIterable
.- Parameters:
item
- The item returned byBlockingIterator
s.- Returns:
- a new
BlockingIterable
generatesBlockingIterator
s that only return a singleitem
.
-
from
public static <T> BlockingIterable<T> from(java.lang.Iterable<T> iterable)
Convert from aIterable
to aBlockingIterable
.- Type Parameters:
T
- The type of data.- Parameters:
iterable
- TheIterable
to convert.- Returns:
- The
BlockingIterable
.
-
from
public static <T> BlockingIterable<T> from(CloseableIterable<T> iterable)
Convert from aIterable
to aCloseableIterable
.- Type Parameters:
T
- The type of data.- Parameters:
iterable
- TheIterable
to convert.- Returns:
- The
CloseableIterable
.
-
-