public class IterableLike extends Object
| Modifier and Type | Method and Description |
|---|---|
static Optional<Type> |
elementTypeOf(Object iterable)
Given an iterable-like object, try to determine its static (i.e, without looking at contents) element type.
|
static Optional<Type> |
elementTypeOf(Type type)
Given an iterable-like type, try to determine its static (i.e, without looking at contents) element type.
|
static boolean |
isEmpty(Object obj)
Attempt to determine if a iterable-like is empty, preferably without iterating.
|
static boolean |
isIterable(Object maybeIterable) |
static Iterable<Object> |
iterable(Object iterable)
Given an iterable object (which may be a iterator, iterable, primitive
or reference array), return an iterable over its (possibly boxed) elements.
|
static Iterator<Object> |
of(Object iterable)
Given an iterable object (which may be a iterator, iterable, primitive
or reference array), return an iterator over its (possibly boxed) elements.
|
static Stream<Object> |
stream(Object iterable)
Given an iterable object (which may be a iterator, iterable, primitive
or reference array), return a
Stream over its (possibly boxed) elements. |
static List<Object> |
toList(Object iterable)
Collect an iterable-like into a newly allocated ArrayList.
|
public static Optional<Type> elementTypeOf(Object iterable)
public static Optional<Type> elementTypeOf(Type type)
public static boolean isEmpty(Object obj)
obj - the iterable-like to check for emptinesspublic static boolean isIterable(Object maybeIterable)
maybeIterable - the object that might be iterableIterableLike can iterate over the given objectpublic static Iterable<Object> iterable(Object iterable)
iterable - the iterable-like to create a real Iterable forpublic static Iterator<Object> of(Object iterable)
iterable - the iterable-likepublic static Stream<Object> stream(Object iterable)
Stream over its (possibly boxed) elements.Copyright © 2019. All rights reserved.