Package org.jdbi.v3.core.internal
Class IterableLike
java.lang.Object
org.jdbi.v3.core.internal.IterableLike
Implements Iterator methods for unidentified arrays and Iterable things that do not
have a more specific type than Object. Note that its elements will be returned as
Object, primitives included (will be autoboxed).
-
Method Summary
Modifier and TypeMethodDescriptionelementTypeOf
(Object iterable) Given an iterable-like object, try to determine its static (i.e, without looking at contents) element type.elementTypeOf
(Type type) Given an iterable-like type, try to determine its static (i.e, without looking at contents) element type.static boolean
isIterable
(Object maybeIterable) Returns true if the given object is iterable.Given an iterable object (which may be a iterator, iterable, primitive or reference array), return an iterable over its (possibly boxed) elements.Given an iterable object (which may be a iterator, iterable, primitive or reference array), return an iterator over its (possibly boxed) elements.Given an iterable object (which may be a iterator, iterable, primitive or reference array), return aStream
over its (possibly boxed) elements.Collect an iterable-like into a newly allocated ArrayList.
-
Method Details
-
isIterable
Returns true if the given object is iterable.- Parameters:
maybeIterable
- the object that might be iterable.- Returns:
- whether
IterableLike
can iterate over the given object.
-
of
Given an iterable object (which may be a iterator, iterable, primitive or reference array), return an iterator over its (possibly boxed) elements.- Parameters:
iterable
- the iterable-like- Returns:
- an iterator of the given array's elements
-
elementTypeOf
Given an iterable-like object, try to determine its static (i.e, without looking at contents) element type. -
elementTypeOf
Given an iterable-like type, try to determine its static (i.e, without looking at contents) element type. -
stream
Given an iterable object (which may be a iterator, iterable, primitive or reference array), return aStream
over its (possibly boxed) elements.- Returns:
- a stream of the given array's elements
-
iterable
Given an iterable object (which may be a iterator, iterable, primitive or reference array), return an iterable over its (possibly boxed) elements.- Parameters:
iterable
- the iterable-like to create a real Iterable for- Returns:
- the created Iterable
-
toList
Collect an iterable-like into a newly allocated ArrayList.- Parameters:
iterable
- the iterable-like to collect- Returns:
- a new list with the elements
-