Class LazyMatchingTypeIterator<T>
- java.lang.Object
-
- org.apache.sshd.common.util.helper.LazyMatchingTypeIterator<T>
-
- Type Parameters:
T
- Type of iterated element
- All Implemented Interfaces:
java.util.Iterator<T>
public class LazyMatchingTypeIterator<T> extends java.lang.Object implements java.util.Iterator<T>
AnIterator
that selects only objects of a certain type from the underlying available ones. The "lazy" denomination is due to the fact that selection occurs only whenhasNext()
is called
-
-
Constructor Summary
Constructors Constructor Description LazyMatchingTypeIterator(java.util.Iterator<?> 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.util.Iterator<?>
getValues()
boolean
hasNext()
static <T> java.util.Iterator<T>
lazySelectMatchingTypes(java.util.Iterator<?> values, java.lang.Class<T> type)
T
next()
java.lang.String
toString()
-
-
-
Constructor Detail
-
LazyMatchingTypeIterator
public LazyMatchingTypeIterator(java.util.Iterator<?> values, java.lang.Class<T> type)
-
-
Method Detail
-
getValues
public java.util.Iterator<?> getValues()
-
getType
public java.lang.Class<T> getType()
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<T>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
lazySelectMatchingTypes
public static <T> java.util.Iterator<T> lazySelectMatchingTypes(java.util.Iterator<?> 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:
- An
Iterator
whosenext()
call 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.
-
-