Class LazyMatchingTypeIterable<T>
- java.lang.Object
-
- org.apache.sshd.common.util.helper.LazyMatchingTypeIterable<T>
-
- Type Parameters:
T
- Type of element being selected
- All Implemented Interfaces:
java.lang.Iterable<T>
public class LazyMatchingTypeIterable<T> extends java.lang.Object implements java.lang.Iterable<T>
Provides a selectiveIterable
over values that match a specific type out of all available. The "lazy" denomination is due to the fact that the next matching value is calculated on-the-fly every timeIterator.hasNext()
is called
-
-
Constructor Summary
Constructors Constructor Description LazyMatchingTypeIterable(java.lang.Iterable<?> values, java.lang.Class<T> type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<T>
getType()
java.lang.Iterable<?>
getValues()
java.util.Iterator<T>
iterator()
static <T> java.lang.Iterable<T>
lazySelectMatchingTypes(java.lang.Iterable<?> values, java.lang.Class<T> type)
java.lang.String
toString()
-
-
-
Field Detail
-
values
private final java.lang.Iterable<?> values
-
type
private final java.lang.Class<T> type
-
-
Constructor Detail
-
LazyMatchingTypeIterable
public LazyMatchingTypeIterable(java.lang.Iterable<?> values, java.lang.Class<T> type)
-
-
Method Detail
-
getValues
public java.lang.Iterable<?> getValues()
-
getType
public java.lang.Class<T> getType()
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
lazySelectMatchingTypes
public static <T> java.lang.Iterable<T> lazySelectMatchingTypes(java.lang.Iterable<?> values, java.lang.Class<T> type)
- Type Parameters:
T
- Type if iterated element- Parameters:
values
- The source values - ignored ifnull
type
- The (never @code null) type of values to select - any value whose type is assignable to this type will be selected by the iterator.- Returns:
Iterable
whoseIterator
selects only values matching the specific type. Note: the matching values are not pre-calculated (hence the "lazy" denomination) - i.e., the match is performed only whenIterator.hasNext()
is called.
-
-