Top Description Fields Constructors Methods
org.apache.sshd.common.util.helper

public Class LazyMatchingTypeIterable<T>

extends Object
implements Iterable<T>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Type Parameters
<T>
Type of element being selected
Imports
java.util.Collections, .Iterator, .Objects

Provides a selective Iterable 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 time Iterator#hasNext() is called
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private final Class<T>
private final Iterable<?>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Class<T>
public Iterable<?>
public Iterator<T>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public static <
Type if iterated element
T
>
Iterable<T>

Returns:

Iterable whose Iterator 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 when Iterator#hasNext() is called.

lazySelectMatchingTypes
(Iterable<?>
The source values - ignored if null
values
,
Class<T>
The (never @code null) type of values to select - any value whose type is assignable to this type will be selected by the iterator.
type
)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

typeback to summary
private final Class<T> type
valuesback to summary
private final Iterable<?> values

Constructor Detail

LazyMatchingTypeIterableback to summary
public LazyMatchingTypeIterable(Iterable<?> values, Class<T> type)

Method Detail

getTypeback to summary
public Class<T> getType()
getValuesback to summary
public Iterable<?> getValues()
iteratorback to summary
public Iterator<T> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<T>

an Iterator.

Annotations
@Override
lazySelectMatchingTypesback to summary
public static <T> Iterable<T> lazySelectMatchingTypes(Iterable<?> values, Class<T> type)
Parameters
<T>
Type if iterated element
values:Iterable<?>

The source values - ignored if null

type:Class<T>

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<T>

Iterable whose Iterator 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 when Iterator#hasNext() is called.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override