Class Collections
java.lang.Object
com.thebuzzmedia.exiftool.commons.iterables.Collections
Static Collection Utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
addAll
(Collection<T> collection, Iterable<T> iterable) Add all elements of given iterable structure to given collection.static <T> boolean
isEmpty
(Collection<T> values) Check if collection is empty (null
or empty).static <T> boolean
isNotEmpty
(Collection<T> values) Check if collection is not empty (notnull
and not empty).static <T> int
size
(Collection<T> values) Get size of collection.static <T> Collection
<T> toCollection
(Iterable<T> iterables) Create in memory collection from given iterable elements.
-
Method Details
-
isEmpty
Check if collection is empty (null
or empty).- Type Parameters:
T
- Type of element in collection.- Parameters:
values
- Collection of values.- Returns:
true
if collection is empty (null
or empty),false
otherwise.
-
isNotEmpty
Check if collection is not empty (notnull
and not empty).- Type Parameters:
T
- Type of element in collection.- Parameters:
values
- Collection of values.- Returns:
true
if collection is not empty (notnull
and not empty),false
otherwise.
-
size
Get size of collection. If collection is empty (null or empty), zero will be returned.- Type Parameters:
T
- Type of element in collection.- Parameters:
values
- Collection of values.- Returns:
- Size of collection.
-
toCollection
Create in memory collection from given iterable elements.- If
iterables
is null, an empty array list is returned. - If
iterables
is already an instance ofCollection
, it is returned. - Otherwise, iterable structure is iterated and loaded into an
ArrayList
.
- Type Parameters:
T
- Type of element in iterable structure.- Parameters:
iterables
- Given iterable.- Returns:
- The collection result.
- If
-
addAll
Add all elements of given iterable structure to given collection.- Type Parameters:
T
- Type of elements.- Parameters:
collection
- The collection.iterable
- The iterable structure.
-