public final class Types
extends java.lang.Object
Have a look at package generics to get an overview.
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<? extends java.lang.Comparable> |
COMPARABLE_COMPARATOR
Comparator which compares Comparables in their natural order.
|
static PrimitiveBooleanIterator |
EMPTY_BOOLEAN_ITERATOR
Empty primitive boolean iterator.
|
static PrimitiveByteIterator |
EMPTY_BYTE_ITERATOR
Empty primitive byte iterator.
|
static PrimitiveCharIterator |
EMPTY_CHAR_ITERATOR
Empty primitive char iterator.
|
static java.util.PrimitiveIterator.OfDouble |
EMPTY_DOUBLE_ITERATOR
Empty primitve double iterator.
|
static PrimitiveFloatIterator |
EMPTY_FLOAT_ITERATOR
Empty primitive float iterator.
|
static int |
EMPTY_HASH
Hash value for empty collections.
|
static java.util.PrimitiveIterator.OfInt |
EMPTY_INT_ITERATOR
Empty primitive int iterator.
|
static java.util.PrimitiveIterator.OfLong |
EMPTY_LONG_ITERATOR
Empty primitive long iterator.
|
static PrimitiveShortIterator |
EMPTY_SHORT_ITERATOR
Empty primitive short iterator.
|
static Predicate1<java.lang.Object> |
NOT_NULL
Predicate for filtering out null objects.
|
static Function1<java.lang.Byte,java.lang.Number> |
NUMBER_TO_BYTE
A type converter allowing any number based type to be converted to a byte value.
|
static Function1<java.lang.Double,java.lang.Number> |
NUMBER_TO_DOUBLE
A type converter allowing any number based type to be converted to double.
|
static Function1<java.lang.Float,java.lang.Number> |
NUMBER_TO_FLOAT
A type converter allowing any number based type to be converted to float.
|
static Function1<java.lang.Integer,java.lang.Number> |
NUMBER_TO_INT
A type converter allowing any number based type to be converted to integer.
|
static Function1<java.lang.Long,java.lang.Number> |
NUMBER_TO_LONG
A type converter allowing any number based type to be converted to long.
|
static Function1<java.lang.Short,java.lang.Number> |
NUMBER_TO_SHORT
A type converter allowing any number based type to be converted to short integer.
|
static java.lang.String |
RELEASE_DATE
Deprecated.
Use
ModuleVersion.VERSION instead, or
ModuleVersionService.iterator() /ModuleVersionService.collectServices() for all modules |
static Function1<java.lang.Boolean,java.lang.String> |
STR_TO_BOOLEAN
A converter which converts strings to boolean values.
|
static FragileTypeConverter<java.lang.Byte,java.lang.String> |
STR_TO_BYTE
A converter which converts strings to byte values, using base 10.
|
static FragileTypeConverter<java.lang.Byte,java.lang.String> |
STR_TO_BYTE_BASE_16
A converter which converts strings to byte values, using base 16.
|
static FragileTypeConverter<java.lang.Byte,java.lang.String> |
STR_TO_BYTE_BASE_2
A converter which converts strings to byte values, using base 2.
|
static FragileTypeConverter<java.lang.Byte,java.lang.String> |
STR_TO_BYTE_BASE_8
A converter which converts strings to byte values, using base 8.
|
static FragileTypeConverter<java.lang.Double,java.lang.String> |
STR_TO_DOUBLE
A converter which converts strings (in Java number format) to double values.
|
static FragileTypeConverter<java.lang.Float,java.lang.String> |
STR_TO_FLOAT
A converter which converts strings (in Java number format) to float values.
|
static FragileTypeConverter<java.lang.Integer,java.lang.String> |
STR_TO_INT
A converter which converts strings to integer, using base 10.
|
static FragileTypeConverter<java.lang.Integer,java.lang.String> |
STR_TO_INT_BASE_16
A converter which converts strings to integer, using base 16.
|
static FragileTypeConverter<java.lang.Integer,java.lang.String> |
STR_TO_INT_BASE_2
A converter which converts strings to integer, using base 2.
|
static FragileTypeConverter<java.lang.Integer,java.lang.String> |
STR_TO_INT_BASE_8
A converter which converts strings to integer, using base 8.
|
static FragileTypeConverter<java.lang.Long,java.lang.String> |
STR_TO_LONG
A converter which converts strings to long integer, using base 10.
|
static FragileTypeConverter<java.lang.Long,java.lang.String> |
STR_TO_LONG_BASE_16
A converter which converts strings to long integer, using base 16.
|
static FragileTypeConverter<java.lang.Long,java.lang.String> |
STR_TO_LONG_BASE_2
A converter which converts strings to long integer, using base 2.
|
static FragileTypeConverter<java.lang.Long,java.lang.String> |
STR_TO_LONG_BASE_8
A converter which converts strings to long integer, using base 8.
|
static Function1<java.lang.String,java.lang.String> |
STR_TO_LOWER
A converter which changes strings to lowercase.
|
static FragileTypeConverter<java.lang.Short,java.lang.String> |
STR_TO_SHORT
A converter which converts strings to short integer, using base 10.
|
static FragileTypeConverter<java.lang.Short,java.lang.String> |
STR_TO_SHORT_BASE_16
A converter which converts strings to short integer, using base 16.
|
static FragileTypeConverter<java.lang.Short,java.lang.String> |
STR_TO_SHORT_BASE_2
A converter which converts strings to short integer, using base 2.
|
static FragileTypeConverter<java.lang.Short,java.lang.String> |
STR_TO_SHORT_BASE_8
A converter which converts strings to short integer, using base 8.
|
static Function1<java.lang.String,java.lang.String> |
STR_TO_UPPER
A converter which changes strings to uppercase.
|
static Function1<java.lang.String,java.lang.Object> |
TO_STRING
A type converter which converts any object into its toString() representation.
|
static java.util.Comparator<?> |
TO_STRING_COMPARATOR
Comparator which compares the toString() representation.
|
static java.util.Comparator<?> |
TO_STRING_IGNORE_CASE_COMPARATOR
Comparator which compares the toString() representation in case-insensitive order.
|
static java.lang.String |
VERSION
Deprecated.
use
ModuleVersion.VERSION instead |
static Function1<java.util.List<java.lang.String>,java.lang.String> |
WORD_SPLIT
A converter which splits strings into words.
|
Modifier and Type | Method and Description |
---|---|
static <C extends java.util.Collection<T>,T> |
addAll(C collection,
java.util.Enumeration<? extends T> enumeration)
Add all elements of an enumeration to a collection.
|
static <C extends java.util.Collection<T>,T> |
addAll(C collection,
java.lang.Iterable<? extends T> iterable)
Add all elements of an iterable to a collection.
|
static <C extends java.util.Collection<T>,T> |
addAll(C collection,
java.util.Iterator<? extends T> iterator)
Add all elements of an iterator to a collection.
|
static <C extends java.util.Collection<? super T>,T> |
addAll(C collection,
T... elements)
Add all elements to a collection.
|
static <C extends java.util.Collection<T>,T> |
addEnumeration(C collection,
java.util.Enumeration<? extends T> enumeration)
Deprecated.
Use
addAll(Collection, Enumeration) instead |
static <C extends java.util.Collection<T>,T> |
addIterable(C collection,
java.lang.Iterable<? extends T> iterable)
Deprecated.
Use
addAll(Collection, Iterable) instead |
static <C extends java.util.Collection<T>,T> |
addIterator(C collection,
java.util.Iterator<? extends T> iterator)
Deprecated.
Use
addAll(Collection, Iterator) instead |
static <T> boolean |
all(java.util.Enumeration<T> enumeration,
java.util.function.Predicate<? super T> checker)
Does every element of the enumeration fulfill the predicate?
|
static <T> boolean |
all(java.lang.Iterable<T> iterable,
java.util.function.Predicate<? super T> checker)
Does every element in the iterable fulfill the predicate?
|
static <T> boolean |
all(java.util.Iterator<T> iterator,
java.util.function.Predicate<? super T> checker)
Does every element of the iterator fulfill the predicate?
|
static <T> boolean |
all(T[] array,
java.util.function.Predicate<? super T> checker)
Does every element in the array fulfill the predicate?
|
static <T> boolean |
any(java.util.Enumeration<T> enumeration,
java.util.function.Predicate<? super T> checker)
Does any element of the enumeration fulfill the predicate?
|
static <T> boolean |
any(java.lang.Iterable<T> iterable,
java.util.function.Predicate<? super T> checker)
Does any element in the iterable fulfill the predicate?
|
static <T> boolean |
any(java.util.Iterator<T> iterator,
java.util.function.Predicate<? super T> checker)
Does any element of the iterator fulfill the predicate?
|
static <T> boolean |
any(T[] array,
java.util.function.Predicate<? super T> checker)
Does any element in the array fulfill the predicate?
|
static <T1,T2> boolean |
areEqual(java.util.Collection<T1> c1,
java.util.Collection<T2> c2)
Are two collections equal?
|
static <T1,T2> boolean |
areEqual(java.util.Collection<T1> c1,
java.util.Collection<T2> c2,
java.util.function.BiPredicate<? super T1,? super T2> matcher)
Are two collections equal?
|
static <T1,T2> boolean |
areEqual(Countable<T1> c1,
Countable<T2> c2)
Are two countables equal?
|
static <T1,T2> boolean |
areEqual(Countable<T1> c1,
Countable<T2> c2,
java.util.function.BiPredicate<? super T1,? super T2> matcher)
Are two countables equal?
|
static <T1,T2> boolean |
areEqual(java.util.Enumeration<T1> en1,
java.util.Enumeration<T2> en2)
Are two enumerators equal?
|
static <T1,T2> boolean |
areEqual(java.util.Enumeration<T1> en1,
java.util.Enumeration<T2> en2,
java.util.function.BiPredicate<? super T1,? super T2> matcher)
Are two enumerators equal?
|
static <T1,T2> boolean |
areEqual(java.lang.Iterable<T1> it1,
java.lang.Iterable<T2> it2)
Are two iterables equal?
|
static <T1,T2> boolean |
areEqual(java.lang.Iterable<T1> it1,
java.lang.Iterable<T2> it2,
java.util.function.BiPredicate<? super T1,? super T2> matcher)
Are two iterables equal?
|
static <T1,T2> boolean |
areEqual(java.util.Iterator<T1> it1,
java.util.Iterator<T2> it2)
Are two iterations equal?
|
static <T1,T2> boolean |
areEqual(java.util.Iterator<T1> it1,
java.util.Iterator<T2> it2,
java.util.function.BiPredicate<? super T1,? super T2> matcher)
Are two iterations equal?
|
static <T1,T2> boolean |
areEqual(T1[] arr1,
T2[] arr2)
Are two arrays equal?
|
static <T1,T2> boolean |
areEqual(T1[] arr1,
T2[] arr2,
java.util.function.BiPredicate<? super T1,? super T2> matcher)
Are two arrays equal?
|
static <T> T |
as(java.lang.Class<T> type,
java.lang.Object obj)
Cast an item to a given type if possible.
|
static <T> java.util.List<T> |
asList(T... array)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static <T> java.util.List<T> |
asList(T[] array,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static <T> java.util.List<T> |
asList(T[] array,
int start,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static <T,S> FragileTypeConverter<T,S> |
asTypeConverter(FragileFunction1<T,? extends java.lang.Exception,S> function)
Use a fragile function with 1 argument as a type converter.
|
static <S> PrimitiveBooleanIterable |
booleanView(java.lang.Iterable<S> sourceIterable,
java.util.function.Predicate<? super S> booleanMapper)
View a generic iterable as if it is an iterable of primitive
boolean values. |
static <S> PrimitiveBooleanIterator |
booleanView(java.util.Iterator<S> sourceIterator,
java.util.function.Predicate<? super S> booleanMapper)
View a generic iterator as if it is an iterator for primitive boolean values.
|
static <S> PrimitiveByteIterable |
byteView(java.lang.Iterable<S> sourceIterable,
ToByteFunction<? super S> byteMapper)
View a generic iterable as if it is an iterable of primitive
byte values. |
static <S> PrimitiveByteIterator |
byteView(java.util.Iterator<S> sourceIterator,
ToByteFunction<? super S> byteMapper)
View a generic iterator as if it is an iterator for primitive byte values.
|
static <T> java.util.Enumeration<T> |
cast(java.util.Enumeration<? extends T> enumeration)
Get a casted enumeration.
|
static <T> java.lang.Iterable<T> |
cast(java.lang.Iterable<?> iterable)
Get a casted iterable.
|
static <T> java.util.Iterator<T> |
cast(java.util.Iterator<?> iterator)
Get a casted iterator.
|
static <T,S> Function1<T,S> |
castConverter()
A converter which converts a type to a any other type by
applying a cast.
|
static <S> PrimitiveCharIterable |
charView(java.lang.Iterable<S> sourceIterable,
ToCharFunction<? super S> charMapper)
View a generic iterable as if it is an iterable of primitive
char values. |
static <S> PrimitiveCharIterator |
charView(java.util.Iterator<S> sourceIterator,
ToCharFunction<? super S> charMapper)
View a generic iterator as if it is an iterator for primitive char values.
|
static <T> java.util.ArrayList<T> |
clone(java.util.Collection<T> sourceCollection,
java.util.function.Function<T,T> cloner)
Clone a collection.
|
static <T> java.util.ArrayList<T> |
clone(Countable<T> sourceCountable,
java.util.function.Function<T,T> cloner)
Clone a countable.
|
static <T,I,S> Function1<T,S> |
combine(java.util.function.Function<I,T> secondStep,
java.util.function.Function<S,? extends I> firstStep)
Get a combined type converter using an intermediate value.
|
static <T,I,S> FragileTypeConverter<T,S> |
combineEE(FragileTypeConverter<T,I> secondStep,
FragileTypeConverter<? extends I,S> firstStep)
Get a combined type converter using an intermediate value.
|
static <T,I,S> FragileTypeConverter<T,S> |
combineEF(FragileTypeConverter<T,I> secondStep,
java.util.function.Function<S,? extends I> firstStep)
Get a combined type converter using an intermediate value.
|
static <T,I,S> FragileTypeConverter<T,S> |
combineFE(java.util.function.Function<I,T> secondStep,
FragileTypeConverter<? extends I,S> firstStep)
Get a combined type converter using an intermediate value.
|
static <T> java.lang.Iterable<T> |
concat(java.lang.Iterable<? extends T>... iterables)
Concatenate some iterables to a combined iterable.
|
static <T> java.util.Iterator<T> |
concat(java.util.Iterator<? extends T>... iterators)
Concatenate some iterators.
|
static <T> java.lang.Iterable<T> |
concatIterables(java.lang.Iterable<? extends java.lang.Iterable<? extends T>> iterables)
Concatenate some iterables to a combined iterable.
|
static <T> java.util.Iterator<T> |
concatIterators(java.lang.Iterable<? extends java.util.Iterator<? extends T>> iterators)
Concatenate some iterators.
|
static <T,E> boolean |
contains(java.util.Enumeration<T> enumeration,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Is an element contained in an enumeration?
|
static <T,E> boolean |
contains(java.lang.Iterable<T> iterable,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Is an element contained in an iterable?
|
static <T,E> boolean |
contains(java.util.Iterator<T> iterator,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Is an element contained in an iterator?
|
static <T,E> boolean |
contains(T[] array,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Is an element contained in an array?
|
static <T> boolean |
containsAny(java.util.Collection<T> set,
java.lang.Iterable<? extends T> possibleElements)
Check whether any of a bunch of elements is contained in a collection.
|
static <T> boolean |
containsEquals(java.lang.Iterable<T> collection,
T element)
Test whether a collection contains an element which is equal to another element.
|
static <T extends Copyable<T>,C extends java.util.Collection<T>> |
copy(C target,
java.util.Enumeration<T> enumeration)
Get a copy of an enumeration while copying the content.
|
static <T extends Copyable<T>,C extends java.util.Collection<T>> |
copy(C target,
java.lang.Iterable<T> iterable)
Get a copy of an iterable, while copying the content.
|
static <T extends Copyable<T>,C extends java.util.Collection<T>> |
copy(C target,
java.util.Iterator<T> iterator)
Get a copy of an iterator while copying the content.
|
static <T extends Copyable<T>> |
copy(java.util.Collection<T> collection)
Get a copy of a collection, while copying the content.
|
static <T extends Copyable<T>> |
copy(Countable<T> countable)
Get a copy of a countable, while copying the content.
|
static <T extends Copyable<T>,C extends java.util.Collection<T>> |
copy(C target,
T[] array)
Get a copy of an array, while copying the content.
|
static <T extends Copyable<T>> |
copy(java.util.Enumeration<T> enumeration)
Get a copy of an enumeration, while copying the content.
|
static <T extends Copyable<T>> |
copy(Indexable<T> indexable)
Get a copy of a indexable, while copying the content.
|
static <T extends Copyable<T>> |
copy(java.lang.Iterable<T> iterable)
Get a copy of an iterable, while copying the content.
|
static <T extends Copyable<T>> |
copy(java.util.Iterator<T> iterator)
Get a copy of an iterator, while copying the content.
|
static <T extends Copyable<T>> |
copy(T[] array)
Get a copy of an array, while copying the content.
|
static <T,S> TwoWayTypeConverter<T,S> |
createTwoWay(java.util.function.Function<S,T> toConverter,
java.util.function.Function<T,S> backConverter)
Create a two way type converter from two one way type converters.
|
static <S> PrimitiveDoubleIterable |
doubleView(java.lang.Iterable<S> sourceIterable,
java.util.function.ToDoubleFunction<? super S> doubleMapper)
View a generic iterable as if it is an iterable of primitive
double values. |
static <S> java.util.PrimitiveIterator.OfDouble |
doubleView(java.util.Iterator<S> sourceIterator,
java.util.function.ToDoubleFunction<? super S> doubleMapper)
View a generic iterator as if it is an iterator for primitive double values.
|
static <T> java.util.Enumeration<T> |
downCast(java.util.Enumeration<? extends T> enumeration)
Get a down-casted enumeration.
|
static <T,S> java.util.function.Function<S,T> |
downCast(java.util.function.Function<? super S,? extends T> typeConverter)
Downcast a type converter.
|
static <T> java.lang.Iterable<T> |
downCast(java.lang.Iterable<? extends T> iterable)
Get a down-casted iterable.
|
static <T> java.util.Iterator<T> |
downCast(java.util.Iterator<? extends T> iterator)
Get a down-casted iterator.
|
static <T,S> FragileTypeConverter<T,S> |
downCastT(FragileTypeConverter<? extends T,? super S> typeConverter)
Downcast a type converter.
|
static <T,S extends T> |
downConverter()
A converter which converts a type to a more basic type.
|
static <T> java.util.Enumeration<T> |
emptyEnumeration()
Return an empty enumeration which does not iterate.
|
static <T> java.lang.Iterable<T> |
emptyIterable()
Return an empty iterable which does not iterate.
|
static <T> java.util.Iterator<T> |
emptyIterator()
Return an empty iterator which does not iterate.
|
static <T> java.util.ListIterator<T> |
emptyListIterator()
Return an empty list iterator which does not iterate.
|
static <T,C extends java.util.Collection<? super T>> |
extract(C target,
java.util.Enumeration<?> enumeration,
java.lang.Class<T> targetType)
Extract all elements of a given type.
|
static <T,C extends java.util.Collection<? super T>> |
extract(C target,
java.lang.Iterable<?> iterable,
java.lang.Class<T> targetType)
Extract all elements of a given type.
|
static <T,C extends java.util.Collection<? super T>> |
extract(C target,
java.util.Iterator<?> iterator,
java.lang.Class<T> targetType)
Extract all elements of a given type.
|
static <T,C extends java.util.Collection<? super T>> |
extract(C target,
java.lang.Object[] array,
java.lang.Class<T> targetType)
Extract all elements of a given type.
|
static <T> java.util.LinkedList<T> |
extract(java.util.Enumeration<?> enumeration,
java.lang.Class<T> targetType)
Extract all elements of a given type.
|
static <T> java.util.LinkedList<T> |
extract(java.lang.Iterable<?> iterable,
java.lang.Class<T> targetType)
Extract all elements of a given type.
|
static <T> java.util.LinkedList<T> |
extract(java.util.Iterator<?> iterator,
java.lang.Class<T> targetType)
Extract all elements of a given type.
|
static <T> java.util.LinkedList<T> |
extract(java.lang.Object[] array,
java.lang.Class<T> targetType)
Extract all elements of a given type.
|
static <T1,T2> java.util.function.BiPredicate<T1,T2> |
falseBiPredicate()
Return a bi-predicate which returns always
false . |
static <T> java.util.function.Predicate<T> |
falsePredicate()
Return a predicate which returns always
false . |
static <T> void |
fillArray(T[] array,
int start,
int length,
java.util.function.Supplier<? extends T> supplier)
Fill part of an array with elements provided by a supplier.
|
static <T> void |
fillArray(T[] array,
java.util.function.Supplier<? extends T> supplier)
Fill an array with elements provided by a supplier.
|
static <T> void |
fillTight(java.util.ArrayList<T> list,
java.util.Collection<? extends T> elements)
Fill an array list with a number of alements.
|
static <T,S> void |
fillTight(java.util.ArrayList<T> list,
java.util.Collection<S> elements,
java.util.function.Function<? super S,? extends T> mapper)
Fill an array list with a number of elements.
|
static <T> void |
fillTight(java.util.ArrayList<T> list,
Countable<? extends T> elements)
Fill an array list with a number of alements.
|
static <T,S> void |
fillTight(java.util.ArrayList<T> list,
Countable<S> elements,
java.util.function.Function<? super S,? extends T> mapper)
Fill an array list with a number of elements.
|
static <T> void |
fillTight(java.util.ArrayList<T> list,
java.lang.Iterable<? extends T> elements)
Fill an array list with a number of alements.
|
static <T,S> void |
fillTight(java.util.ArrayList<T> list,
java.lang.Iterable<S> elements,
java.util.function.Function<? super S,? extends T> mapper)
Fill an array list with a number of elements.
|
static <C extends java.util.Collection<? super T>,T> |
filter(C target,
java.util.Enumeration<T> enumeration,
java.util.function.Predicate<? super T> checker)
Filter the elements of an enumeration into a collection.
|
static <C extends java.util.Collection<? super T>,T> |
filter(C target,
java.lang.Iterable<T> iterable,
java.util.function.Predicate<? super T> checker)
Filter the elements of an iterable into a collection.
|
static <C extends java.util.Collection<? super T>,T> |
filter(C target,
java.util.Iterator<T> iterator,
java.util.function.Predicate<? super T> checker)
Filter the elements of an iterator into a collection.
|
static <C extends java.util.Collection<? super T>,T> |
filter(C target,
T[] array,
java.util.function.Predicate<? super T> filter)
Filter the elements of an array into a collection.
|
static <T> java.util.LinkedList<T> |
filter(java.util.Enumeration<T> enumeration,
java.util.function.Predicate<? super T> checker)
Filter the elements of an enumeration into a result list.
|
static <T> java.util.LinkedList<T> |
filter(java.lang.Iterable<T> iterable,
java.util.function.Predicate<? super T> checker)
Filter the elements of an iterable into a collection.
|
static <T> java.util.LinkedList<T> |
filter(java.util.Iterator<T> iterator,
java.util.function.Predicate<? super T> checker)
Filter the elements of an iterator into a collection.
|
static <T> java.util.LinkedList<T> |
filter(T[] array,
java.util.function.Predicate<? super T> checker)
Filter the elements of an array into a collection.
|
static <T> boolean |
filterOut(java.lang.Iterable<T> iterable,
java.util.function.Predicate<? super T> outCheck)
Filter a modifiable iterable inline.
|
static <K,V> java.util.Set<java.util.Map.Entry<K,V>> |
findAllEntries(java.util.Map<K,V> map,
Predicate2<? super K,? super V> entryChecker)
Return all entries which which the given checker accepts.
|
static <K,V> java.util.Map.Entry<K,V> |
findAnyEntry(java.util.Map<K,V> map,
Predicate2<? super K,? super V> entryChecker)
Find the first entry in a map which the given entry checker accepts.
|
static <K,V> K |
findAnyKey(java.util.Map<K,V> map,
java.util.function.Predicate<? super V> valueChecker)
Find the first key in a map which the given value checker accepts.
|
static <T> T |
findFirst(java.lang.Iterable<T> iterable,
java.util.function.Predicate<? super T> check)
Find the first element which fulfills the given check.
|
static <T> int |
findFirstEqual(java.lang.Iterable<T> collection,
T element)
Find the first element in an collection which is equal to another element.
|
static <T,E> int |
findFirstMatch(java.lang.Iterable<T> collection,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Find the first element in a collection which is matching another element.
|
static <T> T |
findNext(java.util.Enumeration<T> enumeration,
java.util.function.Predicate<? super T> check)
Find the nect element which fulfils the given check.
|
static <T> T |
findNext(java.util.Iterator<T> iterator,
java.util.function.Predicate<? super T> check)
Find the nect element which fulfils the given check.
|
static <T> T |
first(java.lang.Iterable<T> iterable,
java.util.function.Predicate<? super T> checker)
Get the first element which fulfills a check.
|
static <T> java.util.LinkedList<T> |
flatten(java.lang.Iterable<? extends java.lang.Iterable<T>> collectionOfCollections)
Flatten a collection of collections.
|
static <T,R extends java.util.Collection<? super T>> |
flatten(R target,
java.lang.Iterable<? extends java.lang.Iterable<T>> collectionOfCollections)
Flatten a collection of collections.
|
static <S> PrimitiveFloatIterable |
floatView(java.lang.Iterable<S> sourceIterable,
ToFloatFunction<? super S> floatMapper)
View a generic iterable as if it is an iterable of primitive
float values. |
static <S> PrimitiveFloatIterator |
floatView(java.util.Iterator<S> sourceIterator,
ToFloatFunction<? super S> floatMapper)
View a generic iterator as if it is an iterator for primitive float values.
|
static <V,T> V |
foldLeft(java.util.Enumeration<T> enumeration,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do left-associative folding of an enumeration.
|
static <V,T> V |
foldLeft(java.lang.Iterable<T> iterable,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do left-associative folding of an iterable.
|
static <V,T> V |
foldLeft(java.util.Iterator<T> iterator,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do left-associative folding of an iterator.
|
static <V,T> V |
foldLeft(T[] array,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do left-associative folding of an array.
|
static <V,T> V |
foldRight(java.util.Enumeration<T> enumeration,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do right-associative folding of an enumeration.
|
static <V,T> V |
foldRight(java.lang.Iterable<T> iterable,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do right-associative folding of an iterable.
|
static <V,T> V |
foldRight(java.util.Iterator<T> iterator,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do right-associative folding of an iteration.
|
static <V,T> V |
foldRight(java.util.List<T> list,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do right-associative folding of a list.
|
static <V,T> V |
foldRight(java.util.ListIterator<T> reverseIterator,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do right-associative folding of a list iterator using it in reverse direction.
|
static <V,T> V |
foldRight(T[] array,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do right-associative folding of an array.
|
static <T,E extends java.lang.Exception> |
forEach(java.util.Enumeration<T> enumeration,
FragileLoopItemHandler<? super T,E> handler)
Call a handler for each item in an enumeration
|
static <T> void |
forEach(java.util.Enumeration<T> enumeration,
LoopItemHandler<? super T> handler)
Call a handler for each item in an enumeration.
|
static <T,E extends java.lang.Exception> |
forEach(java.lang.Iterable<T> iterable,
FragileLoopItemHandler<? super T,E> handler)
Call a handler for each item in an iterable.
|
static <T> void |
forEach(java.lang.Iterable<T> iterable,
LoopItemHandler<? super T> handler)
Call a handler for each item in an iterable.
|
static <T,E extends java.lang.Exception> |
forEach(java.util.Iterator<T> iterator,
FragileLoopItemHandler<? super T,E> handler)
Call a handler for each item in an iterator
|
static <T> void |
forEach(java.util.Iterator<T> iterator,
LoopItemHandler<? super T> handler)
Call a handler for each item in an iterator.
|
static <T,E extends java.lang.Exception> |
forEach(T[] array,
FragileLoopItemHandler<? super T,E> handler)
Call a handler for each item in an array.
|
static <T> void |
forEach(T[] array,
LoopItemHandler<? super T> handler)
Call a handler for each item in an array.
|
static <T,E extends java.lang.Exception> |
forEachFragile(java.lang.Iterable<T> iterable,
FragileProcedure1<E,? super T> consumer)
Foreach implementation which can be used with consumers which might throw a checked exception.
|
static <T,E extends java.lang.Exception> |
forEachRemainingFragile(java.util.Iterator<T> iterator,
FragileProcedure1<E,? super T> consumer)
Foreach remaining implementation which can be used with consumers which might throw a checked exception.
|
static <T> T |
get(java.lang.Iterable<T> iterable,
int index)
Get the nth element of an iterable.
|
static <T extends Copyable<T>> |
getCopier(java.lang.Class<T> elemClass)
Get a copier function which creates an copy of its argument.
|
static int |
hash(java.lang.Iterable<?> iterable)
Calculate a hash code for a generic iterable.
|
static Indexable<java.lang.Byte> |
indexable(byte... array)
Return an indexable from a primitive byte integer array.
|
static Indexable<java.lang.Double> |
indexable(double... array)
Return an indexable from a primitive double array.
|
static Indexable<java.lang.Float> |
indexable(float... array)
Return an indexable from a primitive float array.
|
static Indexable<java.lang.Integer> |
indexable(int... array)
Return an indexable from a primitive integer array.
|
static Indexable<java.lang.Long> |
indexable(long... array)
Return an indexable from a primitive long integer array.
|
static Indexable<java.lang.Short> |
indexable(short... array)
Return an indexable from a primitive short integer array.
|
static <T,E> int |
indexOf(java.util.Enumeration<T> enumeration,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Get the first index where a given element appears.
|
static <T,E> int |
indexOf(java.util.Enumeration<T> enumeration,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher,
int start)
Get the first index where a given element appears.
|
static <T,E> int |
indexOf(java.lang.Iterable<T> iterable,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Get the first index where a given element appears.
|
static <T,E> int |
indexOf(java.lang.Iterable<T> iterable,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher,
int start)
Get the first index where a given element appears.
|
static <T,E> int |
indexOf(java.util.Iterator<T> iterator,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Get the first index where a given element appears.
|
static <T,E> int |
indexOf(java.util.Iterator<T> iterator,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher,
int start)
Get the first index where a given element appears.
|
static <T,E> int |
indexOf(java.util.List<T> list,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher,
int start)
Get the first index where a given element appears.
|
static <T,E> int |
indexOf(T[] array,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Get the first index where a given element appears.
|
static <T,E> int |
indexOf(T[] array,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher,
int start)
Get the first index where a given element appears.
|
static <S> PrimitiveIntIterable |
intView(java.lang.Iterable<S> sourceIterable,
java.util.function.ToIntFunction<? super S> intMapper)
View a generic iterable as if it is an iterable of primitive
int values. |
static <S> java.util.PrimitiveIterator.OfInt |
intView(java.util.Iterator<S> sourceIterator,
java.util.function.ToIntFunction<? super S> intMapper)
View a generic iterator as if it is an iterator for primitive int values.
|
static <T,S> TwoWayTypeConverter<T,S> |
invert(TwoWayTypeConverter<S,T> typeConverter)
Get an inverted two way type converter from a given one.
|
static java.lang.String |
join(char glue,
java.lang.Iterable<java.lang.String> strings)
Join a bunch of strings into one.
|
static java.lang.String |
join(char glue,
java.util.Iterator<java.lang.String> strings)
Join a bunch of strings into one.
|
static java.lang.String |
join(char glue,
java.lang.String... strings)
Join an array of strings into one.
|
static java.lang.String |
join(java.lang.String glue,
java.util.Enumeration<java.lang.String> strings)
Join a bunch of strings into one.
|
static java.lang.String |
join(java.lang.String glue,
java.lang.Iterable<java.lang.String> strings)
Join a bunch of strings into one.
|
static java.lang.String |
join(java.lang.String glue,
java.util.Iterator<java.lang.String> strings)
Join a bunch of strings into one.
|
static java.lang.String |
join(java.lang.String glue,
java.lang.String... strings)
Join an array of strings into one.
|
static <T> T |
last(java.lang.Iterable<T> iterable,
java.util.function.Predicate<? super T> checker)
Get the last element which fulfills a check.
|
static <T> T |
last(java.util.List<T> list,
java.util.function.Predicate<? super T> checker,
int startIndex)
Get the last element which fulfills a check.
|
static <T,E> int |
lastIndexOf(java.util.List<T> list,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Get the last index where a given element appears.
|
static <T,E> int |
lastIndexOf(java.util.List<T> list,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher,
int start)
Get the last index where a given element appears.
|
static <T,E> T |
lastMatch(java.util.List<T> list,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher)
Get the last matching element where a given element appears.
|
static <T,E> T |
lastMatch(java.util.List<T> list,
E element,
java.util.function.BiPredicate<? super T,? super E> matcher,
int start)
Get the last matching element from a list.
|
static <T extends java.lang.Comparable<T>> |
lexicalCompare(java.lang.Iterable<? extends T> it1,
java.lang.Iterable<? extends T> it2)
Compare two iterables in lexical natural order.
|
static <T> int |
lexicalCompare(java.lang.Iterable<? extends T> it1,
java.lang.Iterable<? extends T> it2,
java.util.Comparator<T> comparator)
Compare two iterables in lexical order.
|
static <T extends java.lang.Comparable<T>> |
lexicalCompare(java.util.Iterator<? extends T> it1,
java.util.Iterator<? extends T> it2)
Compare two iterators in lexical natural order.
|
static <T> int |
lexicalCompare(java.util.Iterator<? extends T> it1,
java.util.Iterator<? extends T> it2,
java.util.Comparator<T> comparator)
Compare two iterators in lexical order.
|
static <S> PrimitiveLongIterable |
longView(java.lang.Iterable<S> sourceIterable,
java.util.function.ToLongFunction<? super S> longMapper)
View a generic iterable as if it is an iterable of primitive
long values. |
static <S> java.util.PrimitiveIterator.OfLong |
longView(java.util.Iterator<S> sourceIterator,
java.util.function.ToLongFunction<? super S> longMapper)
View a generic iterator as if it is an iterator for primitive long values.
|
static <T> ArrayFactory<T> |
makeArrayFactory(java.lang.Class<T> type)
Create an array factory from a type.
|
static <T> Factory<T> |
makeFactory(java.lang.Class<T> type)
Create a factory from a type.
|
static <T> java.util.LinkedList<T> |
makeList(java.util.Enumeration<T> enumeration)
Create a list from an enumeration.
|
static <T> java.util.LinkedList<T> |
makeList(java.lang.Iterable<T> iterable)
Create a list from an iterable.
|
static <T> java.util.LinkedList<T> |
makeList(java.util.Iterator<T> iterator)
Create a list from an iterator.
|
static <C extends java.util.Collection<? super T>,T,S> |
map(C target,
java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an enumeration into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
map(C target,
java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an enumeration into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
map(C target,
java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an iteration into a collection.
|
static <C extends java.util.function.Consumer<? super T>,T,S> |
map(C target,
java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an iteration into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
map(C target,
java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iteration into a collection.
|
static <C extends java.util.function.Consumer<? super T>,T,S> |
map(C target,
java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iteration to a consumer.
|
static <C extends java.util.Collection<? super T>,T,S> |
map(C target,
java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an iterator into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
map(C target,
java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iterator into a collection.
|
static <C extends java.util.function.Consumer<? super T>,T,S> |
map(C target,
java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iterator to a consumer.
|
static <T,S> java.util.ArrayList<T> |
map(java.util.Collection<S> collection,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of a collection.
|
static <T,S> java.util.ArrayList<T> |
map(Countable<S> countable,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of a countable.
|
static <C extends java.util.Collection<? super T>,T,S> |
map(C target,
S[] array,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an array into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
map(C target,
S[] array,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an array into a collection.
|
static <T,S> java.util.LinkedList<T> |
map(java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an enumeration into a collection.
|
static <T,S> java.util.LinkedList<T> |
map(java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an enumeration into a collection.
|
static <T,S> java.util.LinkedList<T> |
map(java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of an iterable.
|
static <T,S> java.util.LinkedList<T> |
map(java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Get the mapped elements of an iterable.
|
static <T,S> java.util.LinkedList<T> |
map(java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of an iterator.
|
static <T,S> java.util.LinkedList<T> |
map(java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iterator into a collection.
|
static <KT,VT,KS,VS> |
map(java.util.Map<KS,VS> source,
java.util.function.Function<java.util.Map.Entry<KS,VS>,java.util.Map.Entry<KT,VT>> typeConverter)
Map one map into another, while allowing to discard elements on the way.
|
static <MT extends java.util.Map<KT,VT>,KT,VT,KS,VS> |
map(MT target,
java.util.Map<KS,VS> source,
java.util.function.Function<java.util.Map.Entry<KS,VS>,? extends java.util.Map.Entry<KT,VT>> typeConverter)
Map one map into another, while allowing to discard elements on the way.
|
static <T,S> java.util.ArrayList<T> |
map(S[] array,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of an array.
|
static <T,S> java.util.LinkedList<T> |
map(S[] array,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Get the mapped elements of an array.
|
static <C extends java.util.Collection<? super T>,T,S> |
mapE(C target,
java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter)
Deprecated.
use
mapFragile(Collection, Enumeration, FragileFunction1) instead which
does not require handling a TypeConverterException |
static <C extends java.util.Collection<? super T>,T,S> |
mapE(C target,
java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Deprecated.
use
mapFragile(Collection, Enumeration, FragileFunction1, Object) instead which
does not require handling a TypeConverterException |
static <C extends java.util.Collection<? super T>,T,S> |
mapE(C target,
java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter)
Deprecated.
use
mapFragile(Collection, Iterable, FragileFunction1) instead which
does not require handling a TypeConverterException |
static <C extends java.util.Collection<? super T>,T,S> |
mapE(C target,
java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Deprecated.
use
mapFragile(Collection, Iterable, FragileFunction1, Object) instead which
does not require handling a TypeConverterException |
static <C extends java.util.Collection<? super T>,T,S> |
mapE(C target,
java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter)
Deprecated.
use
mapFragile(Collection, Iterator, FragileFunction1) instead which
does not require handling a TypeConverterException |
static <C extends java.util.Collection<? super T>,T,S> |
mapE(C target,
java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Deprecated.
use
mapFragile(Collection, Iterator, FragileFunction1, Object) instead which
does not require handling a TypeConverterException |
static <C extends java.util.Collection<? super T>,T,S> |
mapE(C target,
S[] array,
FragileTypeConverter<T,? super S> typeConverter)
Deprecated.
use
mapFragile(Collection, Object[], FragileFunction1) instead which
does not require handling a TypeConverterException |
static <C extends java.util.Collection<? super T>,T,S> |
mapE(C target,
S[] array,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Deprecated.
use
mapFragile(Collection, Object[], FragileFunction1, Object) instead which
does not require handling a TypeConverterException |
static <T,S> java.util.LinkedList<T> |
mapE(java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter)
Deprecated.
use
mapFragile(Enumeration, FragileFunction1) instead which
does not require handling a TypeConverterException |
static <T,S> java.util.LinkedList<T> |
mapE(java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Deprecated.
use
mapFragile(Enumeration, FragileFunction1, Object) instead which
does not require handling a TypeConverterException |
static <T,S> java.util.LinkedList<T> |
mapE(java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter)
Deprecated.
use
mapFragile(Iterable, FragileFunction1) instead which
does not require handling a TypeConverterException |
static <T,S> java.util.LinkedList<T> |
mapE(java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Deprecated.
use
mapFragile(Iterable, FragileFunction1, Object) instead which
does not require handling a TypeConverterException |
static <T,S> java.util.LinkedList<T> |
mapE(java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter)
Deprecated.
use
mapFragile(Iterator, FragileFunction1) instead which
does not require handling a TypeConverterException |
static <T,S> java.util.LinkedList<T> |
mapE(java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Deprecated.
use
mapFragile(Iterator, FragileFunction1, Object) instead which
does not require handling a TypeConverterException |
static <T,S> java.util.LinkedList<T> |
mapE(S[] array,
FragileTypeConverter<T,? super S> typeConverter)
Deprecated.
use
mapFragile(Object[], FragileFunction1) instead which
does not require handling a TypeConverterException |
static <T,S> java.util.LinkedList<T> |
mapE(S[] array,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Deprecated.
use
mapFragile(Object[], FragileFunction1, Object) instead which
does not require handling a TypeConverterException |
static <KT,VT,KS,VS> |
mapEntryConverter(java.util.function.Function<KS,KT> keyConverter,
java.util.function.Function<VS,VT> valueConverter)
Type converter which converts a map entry by simultaneously applying a
converter to the key and to the value.
|
static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> |
mapFragile(C target,
java.util.Enumeration<S> enumeration,
FragileFunction1<? extends T,E,? super S> mapper)
Add the mapped elements of an enumeration into a collection by using a mapper function which might throw
a checked exception.
|
static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> |
mapFragile(C target,
java.util.Enumeration<S> enumeration,
FragileFunction1<? extends T,E,? super S> mapper,
T deleteMark)
Add the mapped elements of an enumeration into a collection while using a mapper which might throw an exception.
|
static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> |
mapFragile(C target,
java.lang.Iterable<S> iterable,
FragileFunction1<? extends T,E,? super S> mapper)
Add the mapped elements of an iterable into a collection by using a mapper function which might throw
a checked exception.
|
static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> |
mapFragile(C target,
java.lang.Iterable<S> iterable,
FragileFunction1<? extends T,E,? super S> mapper,
T deleteMark)
Add the mapped elements of an iterable into a collection while using a mapper which might throw an exception.
|
static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> |
mapFragile(C target,
java.util.Iterator<S> iterator,
FragileFunction1<? extends T,E,? super S> mapper)
Add the mapped elements of an iterator into a collection by using a mapper function which might throw
a checked exception.
|
static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> |
mapFragile(C target,
java.util.Iterator<S> iterator,
FragileFunction1<? extends T,E,? super S> mapper,
T deleteMark)
Add the mapped elements of an iterator into a collection while using a mapper which might throw an exception.
|
static <T,S,E extends java.lang.Exception> |
mapFragile(java.util.Collection<S> collection,
FragileFunction1<? extends T,E,? super S> mapper)
Get the mapped elements of a collection while using a mapper which might throw a checked exception.
|
static <T,S,E extends java.lang.Exception> |
mapFragile(Countable<S> countable,
FragileFunction1<? extends T,E,? super S> mapper)
Get the mapped elements of an array while using a mapper which might throw a checked exception.
|
static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> |
mapFragile(C target,
S[] array,
FragileFunction1<? extends T,E,? super S> mapper)
Add the mapped elements of an array into a collection by using a mapper function which might throw
a checked exception.
|
static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> |
mapFragile(C target,
S[] array,
FragileFunction1<? extends T,E,? super S> mapper,
T deleteMark)
Add the mapped elements of an array into a collection while using a mapper which might throw an exception.
|
static <T,S,E extends java.lang.Exception> |
mapFragile(java.util.Enumeration<S> enumeration,
FragileFunction1<? extends T,E,? super S> mapper)
Get the mapped elements of an enumeration while using a mapper which might throw a checked exception.
|
static <T,S,E extends java.lang.Exception> |
mapFragile(java.util.Enumeration<S> enumeration,
FragileFunction1<? extends T,E,? super S> mapper,
T deleteMark)
Get the mapped elements of an enumeration while using a mapper which might throw an exception.
|
static <T,S,E extends java.lang.Exception> |
mapFragile(java.lang.Iterable<S> iterable,
FragileFunction1<? extends T,E,? super S> mapper)
Get the mapped elements of an iterable while using a mapper which might throw a checked exception.
|
static <T,S,E extends java.lang.Exception> |
mapFragile(java.lang.Iterable<S> iterable,
FragileFunction1<? extends T,E,? super S> mapper,
T deleteMark)
Get the mapped elements of an iterable while using a mapper which might throw an exception.
|
static <T,S,E extends java.lang.Exception> |
mapFragile(java.util.Iterator<S> iterator,
FragileFunction1<? extends T,E,? super S> mapper)
Get the mapped elements of an iterator while using a mapper which might throw a checked exception.
|
static <T,S,E extends java.lang.Exception> |
mapFragile(java.util.Iterator<S> iterator,
FragileFunction1<? extends T,E,? super S> mapper,
T deleteMark)
Get the mapped elements of an iterator while using a mapper which might throw an exception.
|
static <T,S,E extends java.lang.Exception> |
mapFragile(S[] array,
FragileFunction1<? extends T,E,? super S> mapper)
Get the mapped elements of an array while using a mapper which might throw a checked exception.
|
static <T,S,E extends java.lang.Exception> |
mapFragile(S[] array,
FragileFunction1<? extends T,E,? super S> mapper,
T deleteMark)
Get the mapped elements of an array while using a mapper which might throw an exception.
|
static <T,S> java.util.HashMap<T,S> |
mapM(java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an enumeration into a map.
|
static <T,S> java.util.HashMap<T,S> |
mapM(java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an enumeration into a map.
|
static <T,S> java.util.HashMap<T,S> |
mapM(java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of an iterable as a hash map..
|
static <T,S> java.util.HashMap<T,S> |
mapM(java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Get the mapped elements of an iterable to a map.
|
static <T,S> java.util.HashMap<T,S> |
mapM(java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of an iterator as a map.
|
static <T,S> java.util.HashMap<T,S> |
mapM(java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iterator into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapM(M target,
java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an enumeration into a collection.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapM(M target,
java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an enumeration into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapM(M target,
java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an iteration into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapM(M target,
java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iteration into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapM(M target,
java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an iterator into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapM(M target,
java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iterator into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapM(M target,
S[] array,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an array into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapM(M target,
S[] array,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an array into a map.
|
static <T,S> java.util.HashMap<T,S> |
mapM(S[] array,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of an array as a map.
|
static <T,S> java.util.HashMap<T,S> |
mapM(S[] array,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Get the mapped elements of an array as a map.
|
static <T,S> java.util.HashMap<T,S> |
mapME(java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter)
Add the mapped elements of an enumeration into a map.
|
static <T,S> java.util.HashMap<T,S> |
mapME(java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an enumeration to a map.
|
static <T,S> java.util.HashMap<T,S> |
mapME(java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter)
Get the mapped elements of an iterable as a map.
|
static <T,S> java.util.HashMap<T,S> |
mapME(java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Get the mapped elements of an iterable as a map.
|
static <T,S> java.util.HashMap<T,S> |
mapME(java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter)
Get the mapped elements of an iterator as a map.
|
static <T,S> java.util.HashMap<T,S> |
mapME(java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an iterator into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapME(M target,
java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter)
Add the mapped elements of an enumeration to a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapME(M target,
java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an enumeration to a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapME(M target,
java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter)
Add the mapped elements of an iteration into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapME(M target,
java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an iteration into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapME(M target,
java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter)
Add the mapped elements of an iterator to a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapME(M target,
java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an iterator into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapME(M target,
S[] array,
FragileTypeConverter<T,? super S> typeConverter)
Add the mapped elements of an array into a map.
|
static <M extends java.util.Map<? super T,? super S>,T,S> |
mapME(M target,
S[] array,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an array into a map.
|
static <T,S> java.util.HashMap<T,S> |
mapME(S[] array,
FragileTypeConverter<T,? super S> typeConverter)
Get the mapped elements of an array as a map.
|
static <T,S> java.util.HashMap<T,S> |
mapME(S[] array,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Get the mapped elements of an array as a map.
|
static <T,S> java.util.HashMap<S,T> |
mapR(java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an enumeration into a map.
|
static <T,S> java.util.HashMap<S,T> |
mapR(java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an enumeration into a map.
|
static <T,S> java.util.HashMap<S,T> |
mapR(java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of an iterable as a hash map..
|
static <T,S> java.util.HashMap<S,T> |
mapR(java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Get the mapped elements of an iterable to a map.
|
static <T,S> java.util.HashMap<S,T> |
mapR(java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of an iterator as a map.
|
static <T,S> java.util.HashMap<S,T> |
mapR(java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iterator into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapR(M target,
java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an enumeration into a collection.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapR(M target,
java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an enumeration into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapR(M target,
java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an iteration into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapR(M target,
java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iteration into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapR(M target,
java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an iterator into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapR(M target,
java.util.Iterator<S> iterator,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an iterator into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapR(M target,
S[] array,
java.util.function.Function<? super S,T> typeConverter)
Add the mapped elements of an array into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapR(M target,
S[] array,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Add the mapped elements of an array into a map.
|
static <T,S> java.util.HashMap<S,T> |
mapR(S[] array,
java.util.function.Function<? super S,T> typeConverter)
Get the mapped elements of an array as a map.
|
static <T,S> java.util.HashMap<S,T> |
mapR(S[] array,
java.util.function.Function<? super S,T> typeConverter,
T deleteMark)
Get the mapped elements of an array as a map.
|
static <T,S> java.util.HashMap<S,T> |
mapRE(java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter)
Add the mapped elements of an enumeration into a map.
|
static <T,S> java.util.HashMap<S,T> |
mapRE(java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an enumeration to a map.
|
static <T,S> java.util.HashMap<S,T> |
mapRE(java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter)
Get the mapped elements of an iterable as a map.
|
static <T,S> java.util.HashMap<S,T> |
mapRE(java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Get the mapped elements of an iterable as a map.
|
static <T,S> java.util.HashMap<S,T> |
mapRE(java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter)
Get the mapped elements of an iterator as a map.
|
static <T,S> java.util.HashMap<S,T> |
mapRE(java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an iterator into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapRE(M target,
java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter)
Add the mapped elements of an enumeration to a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapRE(M target,
java.util.Enumeration<S> enumeration,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an enumeration to a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapRE(M target,
java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter)
Add the mapped elements of an iteration into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapRE(M target,
java.lang.Iterable<S> iterable,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an iteration into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapRE(M target,
java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter)
Add the mapped elements of an iterator to a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapRE(M target,
java.util.Iterator<S> iterator,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an iterator into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapRE(M target,
S[] array,
FragileTypeConverter<T,? super S> typeConverter)
Add the mapped elements of an array into a map.
|
static <M extends java.util.Map<? super S,? super T>,T,S> |
mapRE(M target,
S[] array,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Add the mapped elements of an array into a map.
|
static <T,S> java.util.HashMap<S,T> |
mapRE(S[] array,
FragileTypeConverter<T,? super S> typeConverter)
Get the mapped elements of an array as a map.
|
static <T,S> java.util.HashMap<S,T> |
mapRE(S[] array,
FragileTypeConverter<T,? super S> typeConverter,
T deleteMark)
Get the mapped elements of an array as a map.
|
static <C extends java.util.Collection<? super T>,T,S> |
mapX(C target,
java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
Add the mapped elements of an enumeration into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
mapX(C target,
java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
Add the mapped elements of an iteration into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
mapX(C target,
java.util.Iterator<S> iterator,
java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
Add the mapped elements of an iterator into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
mapX(C target,
S[] array,
java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
Add the mapped elements of an array into a collection.
|
static <T,S> java.util.LinkedList<T> |
mapX(java.util.Enumeration<S> enumeration,
java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
Add the mapped elements of an enumeration into a collection.
|
static <T,S> java.util.LinkedList<T> |
mapX(java.lang.Iterable<S> iterable,
java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
Get the mapped elements of an iterable.
|
static <T,S> java.util.LinkedList<T> |
mapX(java.util.Iterator<S> iterator,
java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
Get the mapped elements of an iterator.
|
static <KT,VT,KS,VS> |
mapX(java.util.Map<KS,VS> source,
java.util.function.Function<java.util.Map.Entry<? super KS,? super VS>,java.lang.Iterable<java.util.Map.Entry<KT,VT>>> typeConverter)
Map one map into another, while allowing to discard elements on the way.
|
static <MT extends java.util.Map<? super KT,? super VT>,KT,VT,KS,VS> |
mapX(MT target,
java.util.Map<KS,VS> source,
java.util.function.Function<java.util.Map.Entry<? super KS,? super VS>,? extends java.lang.Iterable<? extends java.util.Map.Entry<? extends KT,? extends VT>>> typeConverter)
Map one map into another, allowing to discard or add elements on the way.
|
static <T,S> java.util.LinkedList<T> |
mapX(S[] array,
java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
Get the mapped elements of an array.
|
static <C extends java.util.Collection<? super T>,T,S> |
mapXE(C target,
java.util.Enumeration<S> enumeration,
FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter)
Add the mapped elements of an enumeration into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
mapXE(C target,
java.lang.Iterable<S> iterable,
FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter)
Add the mapped elements of an iteration into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
mapXE(C target,
java.util.Iterator<S> iterator,
FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter)
Add the mapped elements of an iterator into a collection.
|
static <C extends java.util.Collection<? super T>,T,S> |
mapXE(C target,
S[] array,
FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter)
Add the mapped elements of an array into a collection.
|
static <T,S> java.util.LinkedList<T> |
mapXE(java.util.Enumeration<S> enumeration,
FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter)
Add the mapped elements of an enumeration into a collection.
|
static <T,S> java.util.LinkedList<T> |
mapXE(java.lang.Iterable<S> iterable,
FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter)
Get the mapped elements of an iterable.
|
static <T,S> java.util.LinkedList<T> |
mapXE(java.util.Iterator<S> iterator,
FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter)
Get the mapped elements of an iterator.
|
static <T,S> java.util.LinkedList<T> |
mapXE(S[] array,
FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter)
Get the mapped elements of an array.
|
static <T> T |
max(java.util.Comparator<? super T> comparator,
java.lang.Iterable<T> values)
Get the maximal value from some values.
|
static <T> T |
max(java.util.Comparator<? super T> comparator,
T... values)
Get the maximal value from an array of values.
|
static <T extends java.lang.Comparable<? super T>> |
max(java.lang.Iterable<T> values)
Get the maximal value from some comparable values.
|
static <T extends java.lang.Comparable<? super T>> |
max(T... values)
Get the maximal value from an array of comparable values.
|
static byte |
maxByte(byte... values)
Get the maximal value.
|
static char |
maxChar(char... values)
Get the maximal value.
|
static double |
maxDouble(double... values)
Get the maximal value.
|
static double |
maxDouble(java.lang.Iterable<? extends java.lang.Number> iterable)
Get the maximal double value for an iterable of numbers.
|
static <T> double |
maxDouble(java.lang.Iterable<T> iterable,
java.util.function.ToDoubleFunction<? super T> toDouble)
Get the maximal double value from a double view of an iterable.
|
static float |
maxFloat(float... values)
Get the maximal value.
|
static int |
maxInt(int... values)
Get the maximal value.
|
static long |
maxLong(long... values)
Get the maximal value.
|
static short |
maxShort(short... values)
Get the maximal value.
|
static <T> T |
min(java.util.Comparator<? super T> comparator,
java.lang.Iterable<T> values)
Get the minimal value from some values.
|
static <T> T |
min(java.util.Comparator<? super T> comparator,
T... values)
Get the minimal value from an array of values.
|
static <T extends java.lang.Comparable<? super T>> |
min(java.lang.Iterable<T> values)
Get the minimal value from some comparable values.
|
static <T extends java.lang.Comparable<? super T>> |
min(T... values)
Get the minimal value from an array of comparable values.
|
static byte |
minByte(byte... values)
Get the minimal value.
|
static char |
minChar(char... values)
Get the minimal value.
|
static double |
minDouble(double... values)
Get the minimal value.
|
static double |
minDouble(java.lang.Iterable<? extends java.lang.Number> iterable)
Get the minimal double value for an iterable of numbers.
|
static <T> double |
minDouble(java.lang.Iterable<T> iterable,
java.util.function.ToDoubleFunction<? super T> toDouble)
Get the minimal double value from a double view of an iterable.
|
static float |
minFloat(float... values)
Get the minimal value.
|
static int |
minInt(int... values)
Get the minimal value.
|
static long |
minLong(long... values)
Get the minimal value.
|
static short |
minShort(short... values)
Get the minimal value.
|
static java.lang.String |
multiple(java.lang.String str,
int count)
Create a string from a base string repeated multiple times.
|
static <T extends java.lang.Comparable<T>> |
naturalOrder()
Get a comparator which sorts comparables in their natural order.
|
static <T extends java.lang.Comparable<T>> |
naturalOrder(java.lang.Class<T> type)
Deprecated.
use
naturalOrder() instead |
static <T extends java.lang.Comparable<T>> |
naturalOrder(java.util.Collection<T> list)
Deprecated.
use
naturalOrder() instead |
static java.lang.String |
notEmpty(java.lang.String str,
java.lang.String fallback)
Make sure a string is neither
null nor empty. |
static java.lang.String |
notNull(java.lang.String str)
Make sure a string is not
null . |
static <T,D extends T> |
notNull(T item,
D defaultValue)
Make sure that something is not
null . |
static <T> T |
notNullOr(T item,
java.util.function.Supplier<? extends T> provider)
Make sure that something is not
null ,
but postpone the fallback creation. |
static <T> T |
notNullOrN(T item,
java.util.function.Supplier<? extends T> provider)
Try to determine a fallback when a value is
null . |
static <T> Function1<T,T> |
nullConverter()
Type converter which does no conversion.
|
static <T> T |
requireNonNull(T item,
Procedure0 thrower)
Require an item to be not null.
|
static <T> void |
separate(java.lang.Iterable<T> elements,
java.util.Collection<? super T> trueCollect,
java.util.Collection<? super T> falseCollect,
java.util.function.Predicate<? super T> condition)
Go over an iterable and sepparate its elements depending a condition.
|
static <T> void |
separate(java.lang.Iterable<T> elements,
java.util.function.Consumer<? super T> trueCollect,
java.util.function.Consumer<? super T> falseCollect,
java.util.function.Predicate<? super T> condition)
Go over an iterable and sepparate its elements depending a condition.
|
static <T> Pair<java.util.LinkedList<T>> |
separate(java.lang.Iterable<T> elements,
java.util.function.Predicate<? super T> condition)
Go over an iterable and separate its elements into two lists depending on a condition.
|
static <T,C extends java.util.Collection<? super T>> |
separate(java.lang.Iterable<T> elements,
java.util.function.Supplier<C> slotCreator,
java.util.function.Predicate<? super T> condition)
Fo over an iterable and separate its elements depending on a condition.
|
static <S> PrimitiveShortIterable |
shortView(java.lang.Iterable<S> sourceIterable,
ToShortFunction<? super S> shortMapper)
View a generic iterable as if it is an iterable of primitive
short values. |
static <S> PrimitiveShortIterator |
shortView(java.util.Iterator<S> sourceIterator,
ToShortFunction<? super S> shortMapper)
View a generic iterator as if it is an iterator for primitive short values.
|
static java.lang.String |
spaces(int count)
This creates a string consisting only of spaces which is sometimes useful.
|
static <T> java.util.Collection<T> |
synchronizedCollection(java.util.Collection<T> collection)
Get a synchronized collection from a basic collection which is optimized for being often iterated, but rarely changed.
|
static <T> java.util.List<T> |
synchronizedList(java.util.List<T> list)
Get a synchronized list from a basic collection which is optimized for being often iterated, but rarely changed.
|
static boolean[] |
toBooleanArray(java.util.Collection<java.lang.Boolean> c)
Convert a collection of
Boolean s to a raw array of booleans. |
static boolean[] |
toBooleanArray(Countable<java.lang.Boolean> c)
Convert a countable of
Boolean s to a raw array of booleans. |
static byte[] |
toByteArray(java.util.Collection<? extends java.lang.Number> c)
Convert a collection of
Number s to a raw array of bytes. |
static byte[] |
toByteArray(Countable<? extends java.lang.Number> c)
Convert a collection of
Number s to a raw array of bytes. |
static byte[] |
toByteArray(int... bytes)
Convert a number of bytes into a byte array.
|
static double[] |
toDoubleArray(java.util.Collection<? extends java.lang.Number> c)
Convert a collection of
Number s to a raw array of doubles. |
static double[] |
toDoubleArray(Countable<? extends java.lang.Number> c)
Convert a countable of
Number s to a raw array of doubles. |
static <T> java.util.Enumeration<T> |
toEnumeration(java.lang.Iterable<T> iterable)
Convert an iterable into an enumeration.
|
static <T> java.util.Enumeration<T> |
toEnumeration(java.util.Iterator<T> iterator)
Convert an iterator into an enumeration.
|
static <T> java.util.Enumeration<T> |
toEnumeration(T... item)
Convert some items into an enumeration.
|
static float[] |
toFloatArray(java.util.Collection<? extends java.lang.Number> c)
Convert a collection of
Number s to a raw array of floats. |
static float[] |
toFloatArray(Countable<? extends java.lang.Number> c)
Convert a countable of
Number s to a raw array of floats. |
static <T,S> OverCaringTypeConverter<T,S> |
toFragile(java.util.function.Function<S,T> typeConverter)
Make a non-fragile type converter appear as fragile.
|
static int[] |
toIntArray(java.util.Collection<? extends java.lang.Number> c)
Convert a collection of
Number s to a raw array of ints. |
static int[] |
toIntArray(Countable<? extends java.lang.Number> c)
Convert a countable of
Number s to a raw array of ints. |
static <T> java.lang.Iterable<T> |
toIterable(java.util.Enumeration<T> enumeration)
Get a one shot iterable from an enumeration.
|
static <T> java.util.Iterator<T> |
toIterator(java.util.Enumeration<T> enumeration)
Convert an enumeration into an iterator.
|
static <T> java.util.Iterator<T> |
toIterator(T... item)
Convert some items into an iterator.
|
static java.util.List<java.lang.Boolean> |
toList(boolean... array)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Boolean> |
toList(boolean[] array,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Boolean> |
toList(boolean[] array,
int start,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Byte> |
toList(byte... array)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Byte> |
toList(byte[] array,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Byte> |
toList(byte[] array,
int start,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Double> |
toList(double... array)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Double> |
toList(double[] array,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Double> |
toList(double[] array,
int start,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static <T> java.util.LinkedList<T> |
toList(java.util.Enumeration<T> enumeration)
Collect an enumeration into a linked list.
|
static java.util.List<java.lang.Float> |
toList(float... array)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Float> |
toList(float[] array,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Float> |
toList(float[] array,
int start,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Integer> |
toList(int... array)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Integer> |
toList(int[] array,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Integer> |
toList(int[] array,
int start,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static <T> java.util.LinkedList<T> |
toList(java.lang.Iterable<T> iterable)
Collect the elements of an iterable into a linked list.
|
static <T> java.util.LinkedList<T> |
toList(java.util.Iterator<T> iterator)
Collect an iterator into a linked list.
|
static java.util.List<java.lang.Long> |
toList(long... array)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Long> |
toList(long[] array,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Long> |
toList(long[] array,
int start,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Short> |
toList(short... array)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Short> |
toList(short[] array,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static java.util.List<java.lang.Short> |
toList(short[] array,
int start,
int length)
A more effective implementation of
Arrays.asList() ,
useful if only an unmodifiable list is needed. |
static long[] |
toLongArray(java.util.Collection<? extends java.lang.Number> c)
Convert a collection of
Number s to a raw array of long ints. |
static long[] |
toLongArray(Countable<? extends java.lang.Number> c)
Convert a countable of
Number s to a raw array of long ints. |
static <T,E extends java.lang.Exception,L extends FragileLoopItemHandler<T,E>> |
toLoopItemHandler(L handler)
Wrap a careful loop item handler as a simple loop item handler.
|
static <T,S> CarelessTypeConverter<T,S> |
toNonFragile(FragileTypeConverter<T,S> fragileTypeConverter)
Make a fragile type converter appear as a standard type converter.
|
static <T,S> CarelessTypeConverter<T,S> |
toNonFragile(FragileTypeConverter<T,S> fragileTypeConverter,
T defaultValue)
Make a fragile type converter appear as a standard type converter.
|
static <K,V,C extends java.util.Collection<OrderedPair<K,V>>> |
toPairs(C target,
java.util.Map<K,V> map)
Get all entries of a map as a collection of ordered pairs.
|
static <K,V> java.util.ArrayList<OrderedPair<K,V>> |
toPairs(java.util.Map<K,V> map)
Get all entries of a map as a list of ordered pairs.
|
static <R> Function0<R> |
toRobustF0(FragileFunction0<? extends R,?> fragileFunction)
Convert a fragile zero-argument function which could throw an exception into non-fragile one.
|
static <R,P> Function1<R,P> |
toRobustF1(FragileFunction1<? extends R,?,? super P> fragileFunction)
Convert a fragile one-argument function which could throw an exception into non-fragile one.
|
static <R,P1,P2> Function2<R,P1,P2> |
toRobustF2(FragileFunction2<? extends R,?,? super P1,? super P2> fragileFunction)
Convert a fragile two-argument function which could throw an exception into non-fragile one.
|
static <R,P1,P2,P3> |
toRobustF3(FragileFunction3<? extends R,?,? super P1,? super P2,? super P3> fragileFunction)
Convert a fragile 3-argument function which could throw an exception into non-fragile one.
|
static Procedure0 |
toRobustP0(FragileProcedure0<?> fragileProc)
Convert a fragile zero-argument procedure which could throw an exception into non-fragile one.
|
static <P> Procedure1<P> |
toRobustP1(FragileProcedure1<?,? super P> fragileProc)
Convert a fragile one-argument procedure which could throw an exception into non-fragile one.
|
static <P1,P2> Procedure2<P1,P2> |
toRobustP2(FragileProcedure2<?,? super P1,? super P2> fragileProc)
Convert a fragile two-argument procedure which could throw an exception into non-fragile one.
|
static <P1,P2,P3> Procedure3<P1,P2,P3> |
toRobustP3(FragileProcedure3<?,? super P1,? super P2,? super P3> fragileProc)
Convert a fragile 3-argument procedure which could throw an exception into non-fragile one.
|
static short[] |
toShortArray(java.util.Collection<? extends java.lang.Number> c)
Convert a collection of
Number s to a raw array of shorts. |
static short[] |
toShortArray(Countable<? extends java.lang.Number> c)
Convert a countable of
Number s to a raw array of shorts. |
static java.util.LinkedList<java.lang.String> |
toStringList(java.util.Enumeration<?> enumeration)
Collect an enumeration into a linked list of strings.
|
static java.util.LinkedList<java.lang.String> |
toStringList(java.lang.Iterable<?> iterable)
Collect the elements of an iterable into a linked list.
|
static java.util.LinkedList<java.lang.String> |
toStringList(java.util.Iterator<?> iterator)
Collect an iterator into a linked list of strings.
|
static <T1,T2> java.util.function.BiPredicate<T1,T2> |
trueBiPredicate()
Return a bi-predicate which returns always
true . |
static <T> java.util.function.Predicate<T> |
truePredicate()
Return a predicate which returns always
true . |
static <T> java.util.Iterator<T> |
unmodifiable(java.util.Iterator<T> iterator)
Wrap an iterator to keep it from modifying the underlying collection.
|
static <T> java.util.ListIterator<T> |
unmodifiable(java.util.ListIterator<T> iterator)
Wrap a list iterator to keep it from modifying the underlying collection.
|
static <T,S> java.lang.Iterable<T> |
view(java.util.function.Function<? super S,T> mapper,
S... array)
View an array as if it belongs to another iterable type.
|
static <T,S> Indexable<T> |
view(Indexable<S> sourceIndexable,
java.util.function.Function<? super S,T> mapper)
View an indexable.
|
static <T,S> java.lang.Iterable<T> |
view(java.lang.Iterable<S> sourceIterable,
java.util.function.Function<? super S,? extends T> mapper)
View an iterable
Instead of
map(java.lang.Iterable, Function) this
will work transparently on the fly. |
static <T,S> java.util.Iterator<T> |
view(java.util.Iterator<S> sourceIterator,
java.util.function.Function<? super S,? extends T> mapper)
View an iterator as if it belongs to another type.
|
static <T,S> java.util.ListIterator<T> |
view(java.util.ListIterator<S> sourceIterator,
java.util.function.Function<? super S,T> mapper)
View a list iterator as if it belongs to another type.
|
static <T,S> java.util.Collection<T> |
viewCollection(java.util.Collection<S> collection,
java.util.function.Function<? super S,T> mapper)
View a collection as if it has of another element type.
|
static <T,S> java.util.List<T> |
viewList(java.util.List<S> list,
java.util.function.Function<? super S,T> mapper)
View a list as if it has another element type.
|
@Deprecated public static final java.lang.String RELEASE_DATE
ModuleVersion.VERSION
instead, or
ModuleVersionService.iterator()
/ModuleVersionService.collectServices()
for all modules@Deprecated public static final java.lang.String VERSION
ModuleVersion.VERSION
instead@NotNull public static final java.util.Comparator<? extends java.lang.Comparable> COMPARABLE_COMPARATOR
NullPointerException
on null
values.public static final java.util.Comparator<?> TO_STRING_COMPARATOR
NullPointerException
on null
values.public static final java.util.Comparator<?> TO_STRING_IGNORE_CASE_COMPARATOR
NullPointerException
on null
values.public static final java.util.PrimitiveIterator.OfDouble EMPTY_DOUBLE_ITERATOR
public static final java.util.PrimitiveIterator.OfInt EMPTY_INT_ITERATOR
public static final java.util.PrimitiveIterator.OfLong EMPTY_LONG_ITERATOR
public static final PrimitiveBooleanIterator EMPTY_BOOLEAN_ITERATOR
public static final PrimitiveByteIterator EMPTY_BYTE_ITERATOR
public static final PrimitiveShortIterator EMPTY_SHORT_ITERATOR
public static final PrimitiveCharIterator EMPTY_CHAR_ITERATOR
public static final PrimitiveFloatIterator EMPTY_FLOAT_ITERATOR
public static final int EMPTY_HASH
@NotNull public static final Function1<java.lang.String,java.lang.Object> TO_STRING
null
values.@NotNull public static final Function1<java.lang.Double,java.lang.Number> NUMBER_TO_DOUBLE
@NotNull public static final Function1<java.lang.Float,java.lang.Number> NUMBER_TO_FLOAT
@NotNull public static final Function1<java.lang.Long,java.lang.Number> NUMBER_TO_LONG
@NotNull public static final Function1<java.lang.Integer,java.lang.Number> NUMBER_TO_INT
@NotNull public static final Function1<java.lang.Short,java.lang.Number> NUMBER_TO_SHORT
@NotNull public static final Function1<java.lang.Byte,java.lang.Number> NUMBER_TO_BYTE
@NotNull public static final FragileTypeConverter<java.lang.Integer,java.lang.String> STR_TO_INT
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Integer,java.lang.String> STR_TO_INT_BASE_16
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Integer,java.lang.String> STR_TO_INT_BASE_8
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Integer,java.lang.String> STR_TO_INT_BASE_2
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Long,java.lang.String> STR_TO_LONG
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Long,java.lang.String> STR_TO_LONG_BASE_16
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Long,java.lang.String> STR_TO_LONG_BASE_8
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Long,java.lang.String> STR_TO_LONG_BASE_2
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Short,java.lang.String> STR_TO_SHORT
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Short,java.lang.String> STR_TO_SHORT_BASE_16
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Short,java.lang.String> STR_TO_SHORT_BASE_8
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Short,java.lang.String> STR_TO_SHORT_BASE_2
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Byte,java.lang.String> STR_TO_BYTE
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Byte,java.lang.String> STR_TO_BYTE_BASE_16
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Byte,java.lang.String> STR_TO_BYTE_BASE_8
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Byte,java.lang.String> STR_TO_BYTE_BASE_2
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Double,java.lang.String> STR_TO_DOUBLE
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final FragileTypeConverter<java.lang.Float,java.lang.String> STR_TO_FLOAT
It may throw a TypeConverterException
wrapping
a NumberFormatException
@NotNull public static final Function1<java.lang.Boolean,java.lang.String> STR_TO_BOOLEAN
It follows the semantics of Boolean.valueOf(String)
,
but will pass through null
values.
.
public static final Function1<java.util.List<java.lang.String>,java.lang.String> WORD_SPLIT
public static final Function1<java.lang.String,java.lang.String> STR_TO_LOWER
public static final Function1<java.lang.String,java.lang.String> STR_TO_UPPER
public static final Predicate1<java.lang.Object> NOT_NULL
@NotNull @Deprecated public static <T extends java.lang.Comparable<T>> java.util.Comparator<T> naturalOrder(@NotNull java.lang.Class<T> type)
naturalOrder()
insteadT
- comparable typetype
- comparable type class@NotNull @Deprecated public static <T extends java.lang.Comparable<T>> java.util.Comparator<T> naturalOrder(@NotNull java.util.Collection<T> list)
naturalOrder()
insteadT
- comparable typelist
- collection with comparable type@NotNull public static <T extends java.lang.Comparable<T>> java.util.Comparator<T> naturalOrder()
T
- comparable tyoe@NotNull public static <T,S extends T> Function1<T,S> downConverter()
S
- source type which extends the target typeT
- target type (base type of source type)@NotNull public static <T,S> Function1<T,S> castConverter()
ClassCastException
.S
- source typeT
- target type@NotNull public static <T> Function1<T,T> nullConverter()
T
- any type@Nullable public static <T> T as(@NotNull java.lang.Class<T> type, @Nullable java.lang.Object obj)
T
- target typetype
- target typeobj
- objectnull
@NotNull public static <KT,VT,KS,VS> Function1<java.util.Map.Entry<KT,VT>,java.util.Map.Entry<KS,VS>> mapEntryConverter(java.util.function.Function<KS,KT> keyConverter, java.util.function.Function<VS,VT> valueConverter)
KT
- target key typeVT
- target value typeKS
- source key typeVS
- source value typekeyConverter
- key convertervalueConverter
- value converterpublic static <T,I,S> Function1<T,S> combine(@NotNull java.util.function.Function<I,T> secondStep, @NotNull java.util.function.Function<S,? extends I> firstStep)
T
- target typeI
- intermediate typeS
- source typesecondStep
- second step, converting the intermediate vale to the target valuefirstStep
- first step, converting the source value to the intermediate valuepublic static <T,I,S> FragileTypeConverter<T,S> combineEF(@NotNull FragileTypeConverter<T,I> secondStep, @NotNull java.util.function.Function<S,? extends I> firstStep)
T
- target typeI
- intermediate typeS
- source typesecondStep
- second step, converting the intermediate vale to the target valuefirstStep
- first step, converting the source value to the intermediate valuepublic static <T,I,S> FragileTypeConverter<T,S> combineFE(@NotNull java.util.function.Function<I,T> secondStep, @NotNull FragileTypeConverter<? extends I,S> firstStep)
T
- target typeI
- intermediate typeS
- source typesecondStep
- second step, converting the intermediate vale to the target valuefirstStep
- first step, converting the source value to the intermediate valuepublic static <T,I,S> FragileTypeConverter<T,S> combineEE(@NotNull FragileTypeConverter<T,I> secondStep, @NotNull FragileTypeConverter<? extends I,S> firstStep)
T
- target typeI
- intermediate typeS
- source typesecondStep
- second step, converting the intermediate vale to the target valuefirstStep
- first step, converting the source value to the intermediate value@NotNull public static <T,S> TwoWayTypeConverter<T,S> invert(@NotNull TwoWayTypeConverter<S,T> typeConverter)
T
- target typeS
- source tyoetypeConverter
- given type converter@NotNull public static <T,S> TwoWayTypeConverter<T,S> createTwoWay(@NotNull java.util.function.Function<S,T> toConverter, @NotNull java.util.function.Function<T,S> backConverter)
T
- target typeS
- source typetoConverter
- converter for normal direction (S to T)backConverter
- converter for back direction (T to S)@NotNull public static <R> Function0<R> toRobustF0(@NotNull FragileFunction0<? extends R,?> fragileFunction)
R
- result type of incoming and outgoing functionfragileFunction
- fragile functionRuntimeException
with the
wrapped original exception if fragileFunction
throws its declared exception@NotNull public static <R,P> Function1<R,P> toRobustF1(@NotNull FragileFunction1<? extends R,?,? super P> fragileFunction)
R
- result type of incoming and outgoing functionP
- parameter type of incoming and outgoing functionfragileFunction
- fragile functionRuntimeException
with the
wrapped original exception if fragileFunction
throws its declared exception@NotNull public static <R,P1,P2> Function2<R,P1,P2> toRobustF2(@NotNull FragileFunction2<? extends R,?,? super P1,? super P2> fragileFunction)
R
- result type of incoming and outgoing functionP1
- first parameter type of incoming and outgoing functionP2
- second parameter type of incoming and outgoing functionfragileFunction
- fragile functionRuntimeException
with the
wrapped original exception if fragileFunction
throws its declared exception@NotNull public static <R,P1,P2,P3> Function3<R,P1,P2,P3> toRobustF3(@NotNull FragileFunction3<? extends R,?,? super P1,? super P2,? super P3> fragileFunction)
R
- result type of incoming and outgoing functionP1
- first parameter type of incoming and outgoing functionP2
- second parameter type of incoming and outgoing functionP3
- third parameter type of incoming and outgoing functionfragileFunction
- fragile functionRuntimeException
with the
wrapped original exception if fragileFunction
throws its declared exception@NotNull public static Procedure0 toRobustP0(@NotNull FragileProcedure0<?> fragileProc)
fragileProc
- fragile procedureRuntimeException
with the
wrapped original exception if fragileProc
throws its declared exception@NotNull public static <P> Procedure1<P> toRobustP1(@NotNull FragileProcedure1<?,? super P> fragileProc)
P
- parameter type of incoming and outgoing procedurefragileProc
- fragile procedureRuntimeException
with the
wrapped original exception if fragileProc
throws its declared exception@NotNull public static <P1,P2> Procedure2<P1,P2> toRobustP2(@NotNull FragileProcedure2<?,? super P1,? super P2> fragileProc)
P1
- first parameter type of incoming and outgoing procedureP2
- second parameter type of incoming and outgoing procedurefragileProc
- fragile procedureRuntimeException
with the
wrapped original exception if fragileProc
throws its declared exception@NotNull public static <P1,P2,P3> Procedure3<P1,P2,P3> toRobustP3(@NotNull FragileProcedure3<?,? super P1,? super P2,? super P3> fragileProc)
P1
- first parameter type of incoming and outgoing procedureP2
- second parameter type of incoming and outgoing procedureP3
- third parameter type of incoming and outgoing procedurefragileProc
- fragile procedureRuntimeException
with the
wrapped original exception if fragileProc
throws its declared exception@NotNull public static <T,S> CarelessTypeConverter<T,S> toNonFragile(@NotNull FragileTypeConverter<T,S> fragileTypeConverter)
T
- target typeS
- source typefragileTypeConverter
- fragile type converternull
on exceptions@NotNull public static <T,S> CarelessTypeConverter<T,S> toNonFragile(@NotNull FragileTypeConverter<T,S> fragileTypeConverter, @Nullable T defaultValue)
T
- target typeS
- source typefragileTypeConverter
- fragile type converterdefaultValue
- default value returned when the fragile type converter throws an exception@NotNull public static <T,S> OverCaringTypeConverter<T,S> toFragile(@NotNull java.util.function.Function<S,T> typeConverter)
T
- target typeS
- source typetypeConverter
- standard non-fragile type converter@NotNull public static <T> java.lang.Iterable<T> downCast(@NotNull java.lang.Iterable<? extends T> iterable)
This allows to view any iterable as being an iterable of a base class of its generic type.
Although casting generic types is frowned upon in general, in this special case using this method
does not harm static type safety. I.e. if your program compiles the code without warnings,
your program will not throw ClassCastException
s as the result of using this method.
Example:
public void drawShapes(Iterable<Shape> shapes) { // ... } // ... Collection<Rectangle2D> rectangles = // ... drawShapes(Types.<Shape>downCast(rectangles));
T
- base typeiterable
- iterable with extended type@NotNull public static <T> java.util.Iterator<T> downCast(@NotNull java.util.Iterator<? extends T> iterator)
This allows to view any iterator as being an iterator of a base class of its generic type.
Although casting generic types is frowned upon in general, in this special case using of this method
does not harm static type safety. I.e. if your program compiles the code without warnings,
your program will not throw ClassCastException
s as the result of using this method.
Example:
public void drawShapes(Iterator<Shape> shapes) { // ... } // ... Collection<Rectangle2D> rectangles = // ... drawShapes(Types.<Shape>downCast(rectangles.iterator());
T
- base typeiterator
- iterator with extended type@NotNull public static <T> java.util.Enumeration<T> downCast(@NotNull java.util.Enumeration<? extends T> enumeration)
This allows to view any enumeration as being an enumeration of a base class of its generic type.
Although casting generic types is frowned upon in general, in this special case usage of this method
does not harm static type safety. I.e. if your program compiles the code without warnings,
your program will not throw ClassCastException
s as the result of using this method.
Example:
public void drawShapes(Enumeration<Shape> shapes) { // ... } // ... GVector<Rectangle2D> rectangles = // ... drawShapes(Types.<Shape>downCast(rectangles.enumeration());
T
- base typeenumeration
- enumeration with extended type@NotNull public static <T,S> java.util.function.Function<S,T> downCast(@NotNull java.util.function.Function<? super S,? extends T> typeConverter)
Using this method is typesafe.
Although casting generic types is frowned upon in general, in this special case usage of this method
does not harm static type safety. I.e. if your program compiles the code without warnings,
your program will not throw ClassCastException
s as the result of using this method.
T
- base type of original target typeS
- extending type of original source typetypeConverter
- type converter to downcast@NotNull public static <T,S> FragileTypeConverter<T,S> downCastT(@NotNull FragileTypeConverter<? extends T,? super S> typeConverter)
Using this method is typesafe.
T
- base type of original target typeS
- extending type of original source typetypeConverter
- type converter to downcast@NotNull public static <T> java.lang.Iterable<T> cast(@NotNull java.lang.Iterable<?> iterable)
Be careful using this method, as it can easily harm static type safety.
I.e. only use when it is guaranteed that all elements returned by the iteration
fulfill the promise that they are of type T. Otherwise a ClassCastException
will be thrown when using the iterator if the iterable.
In other words: you can use this method to compile a program which will fail at runtime! And that is usually a stupid idea. So you should rethink your design before using this method.
The reason for this method is that life isn't perfect, and especially when you have to use libraries (even standard Java ones) this method may prove helpful.
Example:
// we have this naked collection, but we know all its elements are Strings Collection foo = otherLibObject.getCollection(); for (String str : Types.<String>cast(foo)) { // ... }
T
- target typeiterable
- iterable with any tye@NotNull public static <T> java.util.Iterator<T> cast(@NotNull java.util.Iterator<?> iterator)
Be careful using this method, as it can easily harm static type safety.
I.e. only use when it is guaranteed that all elements returned by the iterator
fulfill the promise that they are of type T. Otherwise a ClassCastException
will be thrown when using the iterator.
In other words: you can use this method to compile a program which will fail at runtime! And that is usually a stupid idea. So you should rethink your design before using this method.
The reason for this method is that life isn't perfect, and especially when you have to use libraries (even standard Java ones) this method may prove helpful.
See cast(java.lang.Iterable)
for an easy to adapt example.
T
- target typeiterator
- iterator with any type@NotNull public static <T> java.util.Enumeration<T> cast(@NotNull java.util.Enumeration<? extends T> enumeration)
Be careful using this method, as it can easily harm static type safety.
I.e. only use when it is guaranteed that all elements returned by the enumeration
fulfill the promise that they are of type T. Otherwise a ClassCastException
will be thrown when using the enumeration.
In other words: you can use this method to compile a program which will fail at runtime! And that is a stupid idea. So you should rethink your design before using this method.
The reason for this method is that life isn't perfect, and especially when you have to use libraries (even standard Java ones) this method may prove helpful.
See cast(java.lang.Iterable)
for an easy to adapt example.
T
- target typeenumeration
- enumeration with any type@NotNull public static <T> java.util.LinkedList<T> flatten(@NotNull java.lang.Iterable<? extends java.lang.Iterable<T>> collectionOfCollections)
T
- basic typecollectionOfCollections
- collection to flatten@NotNull public static <T,R extends java.util.Collection<? super T>> R flatten(@NotNull R target, @NotNull java.lang.Iterable<? extends java.lang.Iterable<T>> collectionOfCollections)
T
- basic typeR
- result typetarget
- target collection, where the elements are storedcollectionOfCollections
- collection to flatten@NotNull public static <C extends java.util.Collection<? super T>,T,S> C map(@NotNull C target, @NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(new ArrayList<Double>(values.length), values, new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapM(@NotNull M target, @NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection, using the converted values as keys pointing to the incoming values.
M
- map typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapR(@NotNull M target, @NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection, using the incoming values as keys pointing to the converted values.
M
- map typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <C extends java.util.Collection<? super T>,T,S> C map(@NotNull C target, @NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(new ArrayList<Double>(values.length), Types.asList(values), new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <C extends java.util.function.Consumer<? super T>,T,S> C map(@NotNull C target, @NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(new ArrayList<Double>(values.length), Types.asList(values), new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapM(@NotNull M target, @NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection, using the converted values as keys pointing to the incoming values.
M
- map typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapR(@NotNull M target, @NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection, using the converted values as keys pointing to the incoming values.
M
- map typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <C extends java.util.Collection<? super T>,T,S> C map(@NotNull C target, @NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
See map(java.util.Collection, Iterable, Function)
for an easy to adapt example.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapM(@NotNull M target, @NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection, using the converted values as keys pointing to the incoming values.
M
- map typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapR(@NotNull M target, @NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection, using the incoming values as keys pointing to the converted values.
M
- map typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <C extends java.util.Collection<? super T>,T,S> C map(@NotNull C target, @NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
See map(java.util.Collection, Iterable, Function)
for an easy to adapt example.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapM(@NotNull M target, @NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection, using the converted values as keys pointing to the incoming values.
M
- map typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapR(@NotNull M target, @NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter)
This will add all mapped elements to the target collection, using the converted values as keys pointing to the incoming values.
M
- map typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <KT,VT,KS,VS> java.util.HashMap<KT,VT> map(@NotNull java.util.Map<KS,VS> source, @NotNull java.util.function.Function<java.util.Map.Entry<KS,VS>,java.util.Map.Entry<KT,VT>> typeConverter)
An element is discarded if the type converter returns null
.
KT
- target map key typeVT
- target map value typeKS
- source map key typeVS
- source map value typesource
- source maptypeConverter
- type converter converting map entries@NotNull public static <MT extends java.util.Map<KT,VT>,KT,VT,KS,VS> MT map(@NotNull MT target, @NotNull java.util.Map<KS,VS> source, @NotNull java.util.function.Function<java.util.Map.Entry<KS,VS>,? extends java.util.Map.Entry<KT,VT>> typeConverter)
An element is discarded if the type converter returns null
.
MT
- target map typeKT
- target map key typeVT
- target map value typeKS
- source map key typeVS
- source map value typetarget
- target mapsource
- source maptypeConverter
- type converter converting map entries@NotNull public static <KT,VT,KS,VS> java.util.HashMap<KT,VT> mapX(@NotNull java.util.Map<KS,VS> source, @NotNull java.util.function.Function<java.util.Map.Entry<? super KS,? super VS>,java.lang.Iterable<java.util.Map.Entry<KT,VT>>> typeConverter)
An element is discarded if the type converter returns null
.
KT
- target map key typeVT
- target map value typeKS
- source map key typeVS
- source map value typesource
- source maptypeConverter
- type converter converting map entries@NotNull public static <MT extends java.util.Map<? super KT,? super VT>,KT,VT,KS,VS> MT mapX(@NotNull MT target, @NotNull java.util.Map<KS,VS> source, @NotNull java.util.function.Function<java.util.Map.Entry<? super KS,? super VS>,? extends java.lang.Iterable<? extends java.util.Map.Entry<? extends KT,? extends VT>>> typeConverter)
MT
- target map typeKT
- target map key typeVT
- target map value typeKS
- source map key typeVS
- source map value typetarget
- target mapsource
- source maptypeConverter
- type converter converting map entries@NotNull public static <C extends java.util.Collection<? super T>,T> C filter(@NotNull C target, @NotNull T[] array, @NotNull java.util.function.Predicate<? super T> filter)
This will add all filtered elements to the target collection.
C
- collection typeT
- filtered typetarget
- collection where the mapped elements are addedarray
- array providing the source elementsfilter
- filter to decide which elements are kept,
when returning true
the element is kept,
otherwise it is discarded@NotNull public static <C extends java.util.Collection<? super T>,T> C filter(@NotNull C target, @NotNull java.lang.Iterable<T> iterable, @NotNull java.util.function.Predicate<? super T> checker)
This will add all filtered elements to the target collection.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- filtered typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementschecker
- value checker to decide which elements are kept@NotNull public static <C extends java.util.Collection<? super T>,T> C filter(@NotNull C target, @NotNull java.util.Iterator<T> iterator, @NotNull java.util.function.Predicate<? super T> checker)
This will add all filtered elements to the target collection.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- filtered typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementschecker
- value checker to decide which elements are kept@NotNull public static <C extends java.util.Collection<? super T>,T> C filter(@NotNull C target, @NotNull java.util.Enumeration<T> enumeration, @NotNull java.util.function.Predicate<? super T> checker)
This will add all filtered elements to the target collection.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- filtered typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementschecker
- value checker to decide which elements are kept@NotNull public static <T> java.util.LinkedList<T> filter(@NotNull T[] array, @NotNull java.util.function.Predicate<? super T> checker)
This will add all filtered elements to the target collection.
T
- filtered typearray
- array providing the source elementschecker
- value checker to decide which elements are kept@NotNull public static <T> java.util.LinkedList<T> filter(@NotNull java.lang.Iterable<T> iterable, @NotNull java.util.function.Predicate<? super T> checker)
This will add all filtered elements to the target collection.
T
- filtered typeiterable
- iterable providing the source elementschecker
- value checker to decide which elements are kept@NotNull public static <T> java.util.LinkedList<T> filter(@NotNull java.util.Iterator<T> iterator, @NotNull java.util.function.Predicate<? super T> checker)
This will add all filtered elements to the target collection.
T
- filtered typeiterator
- iterator providing the source elementschecker
- value checker to decide which elements are kept@NotNull public static <T> java.util.LinkedList<T> filter(@NotNull java.util.Enumeration<T> enumeration, @NotNull java.util.function.Predicate<? super T> checker)
T
- filtered typeenumeration
- enumeration providing the source elementschecker
- value checker to decide which elements are keptpublic static <T> boolean filterOut(@NotNull java.lang.Iterable<T> iterable, @NotNull java.util.function.Predicate<? super T> outCheck)
T
- collection element typeiterable
- modifiable iterable expected to provide an iterator which implements
the Iterator.remove()
methodoutCheck
- predicate which returns true
for elements which are expected to be removedtrue
if the collection was mdifiedfalse
if nothing was changedjava.lang.RuntimeException
- whatever the iterator of the iterable throws when calling its remove() methodpublic static <T> boolean any(@NotNull T[] array, @NotNull java.util.function.Predicate<? super T> checker)
This will check all array elements against the predicate, and return
true
on the first positive check.
T
- checked typearray
- array providing the source elementschecker
- value checkertrue
: if any of the elements of the array matches the predicatefalse
: if none of the elements matches or the array is emptypublic static <T> boolean any(@NotNull java.lang.Iterable<T> iterable, @NotNull java.util.function.Predicate<? super T> checker)
This will check all elements against the predicate, and return
true
on the first positive check.
T
- filtered typeiterable
- iterable providing the source elementschecker
- value checkertrue
: if any of the elements of the array matches the predicatefalse
: if none of the elements matches or the iterable is emptypublic static <T> boolean any(@NotNull java.util.Iterator<T> iterator, @NotNull java.util.function.Predicate<? super T> checker)
This will check all elements against the predicate, and return
true
on the first positive check.
T
- filtered typeiterator
- iterator providing the source elementschecker
- value checker to decide which elements are kepttrue
: if any of the elements of the array matches the predicatefalse
: if none of the elements matches or the iterator is emptypublic static <T> boolean any(@NotNull java.util.Enumeration<T> enumeration, @NotNull java.util.function.Predicate<? super T> checker)
This will check all elements against the predicate, and return
true
on the first positive check.
T
- filtered typeenumeration
- enumeration providing the source elementschecker
- value checker to decide which elements are kepttrue
: if any of the elements of the array matches the predicatefalse
: if none of the elements matches or the enumeration is emptypublic static <T> boolean all(@NotNull T[] array, @NotNull java.util.function.Predicate<? super T> checker)
This will check all array elements against the predicate, and return
false
on the first negative check.
T
- checked typearray
- array providing the source elementschecker
- value checkertrue
: if all of the elements of the array match the predicate or the array is emptyfalse
: if any of the elements does not matchpublic static <T> boolean all(@NotNull java.lang.Iterable<T> iterable, @NotNull java.util.function.Predicate<? super T> checker)
This will check all elements against the predicate, and return
false
on the first negative check.
T
- filtered typeiterable
- iterable providing the source elementschecker
- value checkertrue
: if all of the elements of the iterable match the predicate or the iterable is emptyfalse
: if any of the elements does not matchpublic static <T> boolean all(@NotNull java.util.Iterator<T> iterator, @NotNull java.util.function.Predicate<? super T> checker)
This will check all elements against the predicate, and return
false
on the first negative check.
T
- filtered typeiterator
- iterator providing the source elementschecker
- value checker to decide which elements are kepttrue
: if all of the elements of the iterator match the predicate or the iterator is emptyfalse
: if any of the elements does not matchpublic static <T> boolean all(@NotNull java.util.Enumeration<T> enumeration, @NotNull java.util.function.Predicate<? super T> checker)
This will check all elements against the predicate, and return
false
on the first negative check.
T
- filtered typeenumeration
- enumeration providing the source elementschecker
- value checker to decide which elements are kepttrue
: if all of the elements of the enumeration match the predicate or the enumeration is emptyfalse
: if any of the elements does not match@Nullable public static <T> T first(@NotNull java.lang.Iterable<T> iterable, @NotNull java.util.function.Predicate<? super T> checker)
T
- element typeiterable
- iterablechecker
- value checker to decide which elements fitnull
@Nullable public static <T> T last(@NotNull java.lang.Iterable<T> iterable, @NotNull java.util.function.Predicate<? super T> checker)
T
- element typeiterable
- iterablechecker
- value checker to decide which elements fitnull
@Nullable public static <T> T last(@NotNull java.util.List<T> list, @NotNull java.util.function.Predicate<? super T> checker, int startIndex)
T
- element typelist
- list to checkchecker
- value checker to decide which elements fitstartIndex
- start index of searchnull
public static <V,T> V foldLeft(@NotNull T[] array, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
Eg to calculate the integer sum of an array of Numbers, you can use the following code
Number[] array = { 1, Math.PI, 9L }; double result = Types.foldLeft(array, 0.0, new Function2<Double, Double, Number>() { public Double apply(Double arg1, Number arg2) { return arg1 + arg2.doubleValue(); } });
result
will have a value of 13.14... after the call.V
- accumulated value typeT
- array typearray
- array which elements are folded togetherinitialValue
- start valuefolder
- folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldLeft(@NotNull java.lang.Iterable<T> iterable, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
Eg to calculate the integer sum of an array of Numbers, you can use the following code
Collection<Number> numbers = Types.<Number>asList(1, Math.PI, 9L); double result = Types.foldLeft(numbers, 0.0, new Function2<Double, Double, Number>() { public Double apply(Double arg1, Number arg2) { return arg1 + arg2.doubleValue(); } });
result
will have a value of 13.14... after the call.V
- accumulated value typeT
- iterable typeiterable
- iterable which elements are folded togetherinitialValue
- start valuefolder
- folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldLeft(@NotNull java.util.Iterator<T> iterator, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
See foldLeft(Iterable, Object, BiFunction)
for a code example.
V
- accumulated value typeT
- iterable typeiterator
- iterator which elements are folded togetherinitialValue
- start valuefolder
- folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldLeft(@NotNull java.util.Enumeration<T> enumeration, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
See foldLeft(Iterable, Object, BiFunction)
for a code example.
V
- accumulated value typeT
- iterable typeenumeration
- enumeration which elements are folded togetherinitialValue
- start valuefolder
- folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldRight(@NotNull T[] array, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
Currently I have no useful example where right-folding in Java is making sense,
so you should prefer
foldLeft(Object[], Object, BiFunction)
.
V
- accumulated value typeT
- array typearray
- array which elements are folded togetherinitialValue
- start valuefolder
- folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldRight(@NotNull java.lang.Iterable<T> iterable, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
Currently I have no useful example where right-folding in Java is making sense,
so you should prefer
foldLeft(Object[], Object, BiFunction)
,
especially as the implementation for iterables is requiring an intermediate copy.
If you really find a use for right-folding try to use the
foldRight method working on a list
, as it avoids the copy mentioned above.
V
- accumulated value typeT
- iterable typeiterable
- iterable which elements are folded togetherinitialValue
- start valuefolder
- folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldRight(@NotNull java.util.Iterator<T> iterator, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
Currently I have no useful example where right-folding in Java is making sense,
so you should prefer
foldLeft(Iterable, Object, BiFunction)
,
especially as the implementation for iteration is requiring an intermediate copy.
If you really find a use for right-folding you should try to use the
foldRight method working on a list
, as it avoids the copy mentioned above.
V
- accumulated value typeT
- iterator typeiterator
- iterator which elements are folded togetherinitialValue
- start valuefolder
- folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldRight(@NotNull java.util.Enumeration<T> enumeration, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
Currently I have no useful example where right-folding in Java is making sense,
so you should prefer
foldLeft(java.util.Iterator, Object, BiFunction)
,
especially as the implementation for iteration is requiring an intermediate copy.
If you really find a use for right-folding you should try to use the
foldRight method working on a list
, as it avoids the copy mentioned above.
V
- accumulated value typeT
- enumeration typeenumeration
- enumeration which elements are folded togetherinitialValue
- start valuefolder
- folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldRight(@NotNull java.util.List<T> list, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
Currently I have no useful example where right-folding in Java is making sense,
so you should prefer
foldLeft(java.util.Enumeration, Object, BiFunction)
,
especially as the implementation for iteration is requiring an intermediate copy.
V
- accumulated value typeT
- list typelist
- list which elements are folded togetherinitialValue
- start valuefolder
- folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldRight(@NotNull java.util.ListIterator<T> reverseIterator, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
Currently I have no useful example where right-folding in Java is making sense,
so you should prefer
foldLeft(Iterable, Object, BiFunction)
,
especially as the implementation for iteration is requiring an intermediate copy.
V
- accumulated value typeT
- list typereverseIterator
- iterator which is traverse in reverse directioninitialValue
- start valuefolder
- folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combination@NotNull public static <C extends java.util.Collection<? super T>,T,S> C mapX(@NotNull C target, @NotNull S[] array, @NotNull java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(new ArrayList<Double>(values.length), values, new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <C extends java.util.Collection<? super T>,T,S> C mapX(@NotNull C target, @NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(new ArrayList<Double>(values.length), Types.asList(values), new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <C extends java.util.Collection<? super T>,T,S> C mapX(@NotNull C target, @NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
See map(java.util.Collection, Iterable, Function)
for an easy to adapt example.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <C extends java.util.Collection<? super T>,T,S> C mapX(@NotNull C target, @NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
See map(java.util.Collection, Iterable, Function)
for an easy to adapt example.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.LinkedList<T> map(@NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter)
See map(java.util.Collection, Iterable, Function)
for a method which allows to define the
result collection.
See map(Iterable, Function, Object)
for a method which allows to discard elements.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(Types.asList(values), new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.ArrayList<T> map(@NotNull java.util.Collection<S> collection, @NotNull java.util.function.Function<? super S,T> typeConverter)
This method has the advantage that the size of the collection is known, so an ArrayList
is used for the resulting collection.
See map(java.util.Collection, Iterable, Function)
for a method which allows to define the
result collection.
See map(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source targetcollection
- collection to be mappedtypeConverter
- type converter doing the mapping@NotNull public static <T,S> java.util.ArrayList<T> map(@NotNull Countable<S> countable, @NotNull java.util.function.Function<? super S,T> typeConverter)
This method has the advantage that the size of the countable is known, so an ArrayList
is used for the resulting collection.
See map(java.util.Collection, Iterable, Function)
for a method which allows to define the
result collection.
See map(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source targetcountable
- collection to be mappedtypeConverter
- type converter doing the mapping@NotNull public static <T,S> java.util.HashMap<T,S> mapM(@NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter)
The converted values will become keys, pointing to the associated incoming values.
See mapM(java.util.Map, Iterable, Function)
for a method which allows to define the
result map.
See mapM(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.HashMap<S,T> mapR(@NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter)
The incoming values will become keys, pointing to the associated converted values.
See mapR(java.util.Map, Iterable, Function)
for a method which allows to define the
result map.
See mapR(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.ArrayList<T> map(@NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter)
See map(java.util.Collection, Object[], Function)
for a method which allows to define the
result collection.
See map(Object[], Function, Object)
for a method which allows to discard elements.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(values, new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.HashMap<T,S> mapM(@NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter)
The converted values will become keys, pointing to the associated incoming values.
See mapM(java.util.Map, Object[], Function)
for a method which allows to define the
result collection.
See mapM(Object[], Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.HashMap<S,T> mapR(@NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter)
The incoming values will become keys, pointing to the associated converted values.
See mapR(java.util.Map, Object[], Function)
for a method which allows to define the
result collection.
See mapR(Object[], Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.LinkedList<T> map(@NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter)
See map(java.util.Collection, Iterable, Function)
for a method which allows to define the
result collection.
See map(Iterable, Function, Object)
for a method which allows to discard elements.
See map(Iterable, Function)
for an easy to adapt example.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsview(java.util.Iterator, Function)
@NotNull public static <T,S> java.util.HashMap<T,S> mapM(@NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter)
The converted values will become keys, pointing to the associated incoming values.
See mapM(java.util.Map, Iterable, Function)
for a method which allows to define the
result collection.
See mapM(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.HashMap<S,T> mapR(@NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter)
The incoming values will become keys, pointing to the associated converted values.
See mapR(java.util.Map, Iterable, Function)
for a method which allows to define the
result collection.
See mapR(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.LinkedList<T> map(@NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter)
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.HashMap<T,S> mapM(@NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter)
The converted values will become keys, pointing to the associated incoming values.
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.HashMap<S,T> mapR(@NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter)
The incoming values will become keys, pointing to the associated converted values.
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.LinkedList<T> mapX(@NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
See map(java.util.Collection, Iterable, Function)
for a method which allows to define the
result collection.
See map(Iterable, Function, Object)
for a method which allows to discard elements.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(Types.asList(values), new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.LinkedList<T> mapX(@NotNull S[] array, @NotNull java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
See map(java.util.Collection, Object[], Function)
for a method which allows to define the
result collection.
See map(Object[], Function, Object)
for a method which allows to discard elements.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(values, new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.LinkedList<T> mapX(@NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
See map(java.util.Collection, Iterable, Function)
for a method which allows to define the
result collection.
See map(Iterable, Function, Object)
for a method which allows to discard elements.
See map(Iterable, Function)
for an easy to adapt example.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <T,S> java.util.LinkedList<T> mapX(@NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,? extends java.lang.Iterable<T>> typeConverter)
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elements@NotNull public static <C extends java.util.Collection<? super T>,T,S> C map(@NotNull C target, @NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
This method allows to discard elements during the mapping.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapM(@NotNull M target, @NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapR(@NotNull M target, @NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The incoming values will become keys, pointing to the associated mapped values.
This method allows to discard elements during the mapping.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <C extends java.util.Collection<? super T>,T,S> C map(@NotNull C target, @NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
This method allows to discard elements during the mapping.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <C extends java.util.function.Consumer<? super T>,T,S> C map(@NotNull C target, @NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
This method allows to discard elements during the mapping.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- consumer applied to each mapped elementiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapM(@NotNull M target, @NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapR(@NotNull M target, @NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <C extends java.util.Collection<? super T>,T,S> C map(@NotNull C target, @NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
This method allows to discard elements during the mapping.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <C extends java.util.function.Consumer<? super T>,T,S> C map(@NotNull C target, @NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
This method allows to discard elements during the mapping.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- consumer to which all mapped elements are forwardediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapM(@NotNull M target, @NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapR(@NotNull M target, @NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <C extends java.util.Collection<? super T>,T,S> C map(@NotNull C target, @NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
This method allows to discard elements during the mapping.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapM(@NotNull M target, @NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapR(@NotNull M target, @NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.LinkedList<T> map(@NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
This method allows to discard elements during the mapping.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(values, new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.HashMap<T,S> mapM(@NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.HashMap<S,T> mapR(@NotNull S[] array, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.LinkedList<T> map(@NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
This method allows to discard elements during the mapping.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979", "foobar" }; List<Double> result = Types.map(Types.asList(values), new Function1<Double, String>() { public Double convert(String object) { try { return Double.parseDouble(object); } catch (NumberFormatException x) { return null; // delete mark, compare last parameter } } }, null);
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.HashMap<T,S> mapM(@NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.HashMap<S,T> mapR(@NotNull java.lang.Iterable<S> iterable, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.LinkedList<T> map(@NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.HashMap<T,S> mapM(@NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.HashMap<S,T> mapR(@NotNull java.util.Iterator<S> iterator, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.LinkedList<T> map(@NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.HashMap<T,S> mapM(@NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull public static <T,S> java.util.HashMap<S,T> mapR(@NotNull java.util.Enumeration<S> enumeration, @NotNull java.util.function.Function<? super S,T> typeConverter, @Nullable T deleteMark)
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.@NotNull @Deprecated public static <C extends java.util.Collection<? super T>,T,S> C mapE(@NotNull C target, @NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
mapFragile(Collection, Object[], FragileFunction1)
instead which
does not require handling a TypeConverterException
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Example:
// convert an array of strings containing double values into a collection of doubles String[] values = { "1.2", "-7.07", "3.14250255358979" }; List<Double> result = Types.map(new ArrayList<Double>(values.length), values, new Function1<Double, String>() { public Double convert(String object) { return Double.parseDouble(object); } });
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> C mapFragile(@NotNull C target, @NotNull S[] array, @NotNull FragileFunction1<? extends T,E,? super S> mapper) throws E extends java.lang.Exception
C
- type of returned collectionT
- target (mapped) element typeS
- source element typeE
- exception typetarget
- collection where the mapped elements are addedarray
- array providing the source elementsmapper
- mapper function converting the source elements into the target elementsE
- mapper exceptionE extends java.lang.Exception
@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapME(@NotNull M target, @NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This will add all mapped elements to the target map.
See mapM(java.util.Map, Iterable, Function, Object)
for a method
which allows to discard elements.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapRE(@NotNull M target, @NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This will add all mapped elements to the target map.
See mapM(java.util.Map, Iterable, Function, Object)
for a method
which allows to discard elements.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <C extends java.util.Collection<? super T>,T,S> C mapE(@NotNull C target, @NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
mapFragile(Collection, Iterable, FragileFunction1)
instead which
does not require handling a TypeConverterException
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> C mapFragile(@NotNull C target, @NotNull java.lang.Iterable<S> iterable, @NotNull FragileFunction1<? extends T,E,? super S> mapper) throws E extends java.lang.Exception
C
- type of returned collectionT
- target (mapped) element typeS
- source element typeE
- exception typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementsmapper
- mapper function converting the source elements into the target elementsE
- mapper exceptionE extends java.lang.Exception
@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapME(@NotNull M target, @NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This will add all mapped elements to the target map.
See mapM(java.util.Map, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapRE(@NotNull M target, @NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This will add all mapped elements to the target map.
See mapM(java.util.Map, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <C extends java.util.Collection<? super T>,T,S> C mapE(@NotNull C target, @NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
mapFragile(Collection, Iterator, FragileFunction1)
instead which
does not require handling a TypeConverterException
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
See map(java.util.Collection, Iterable, Function)
for an easy to adapt example.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> C mapFragile(@NotNull C target, @NotNull java.util.Iterator<S> iterator, @NotNull FragileFunction1<? extends T,E,? super S> mapper) throws E extends java.lang.Exception
C
- type of returned collectionT
- target (mapped) element typeS
- source element typeE
- exception typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementsmapper
- mapper function converting the source elements into the target elementsE
- mapper exceptionE extends java.lang.Exception
@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapME(@NotNull M target, @NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This will add all mapped elements to the target map.
See mapM(java.util.Map, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
See map(java.util.Collection, Iterable, Function)
for an easy to adapt example.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapRE(@NotNull M target, @NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This will add all mapped elements to the target map.
See mapR(java.util.Map, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <C extends java.util.Collection<? super T>,T,S> C mapE(@NotNull C target, @NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
mapFragile(Collection, Enumeration, FragileFunction1)
instead which
does not require handling a TypeConverterException
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
See map(java.util.Collection, Iterable, Function)
for an easy to adapt example.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> C mapFragile(@NotNull C target, @NotNull java.util.Enumeration<S> enumeration, @NotNull FragileFunction1<? extends T,E,? super S> mapper) throws E extends java.lang.Exception
C
- type of returned collectionT
- target (mapped) element typeS
- source element typeE
- exception typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementsmapper
- mapper function converting the source elements into the target elementsE
- mapper exceptionE extends java.lang.Exception
@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapME(@NotNull M target, @NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This will add all mapped elements to the target map.
See mapM(java.util.Map, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapRE(@NotNull M target, @NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This will add all mapped elements to the target map.
See mapM(java.util.Map, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <T,S> java.util.LinkedList<T> mapE(@NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
mapFragile(Iterable, FragileFunction1)
instead which
does not require handling a TypeConverterException
See map(java.util.Collection, Iterable, Function)
for a method which allows to define the
result collection.
See map(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S,E extends java.lang.Exception> java.util.LinkedList<T> mapFragile(@NotNull java.lang.Iterable<S> iterable, @NotNull FragileFunction1<? extends T,E,? super S> mapper) throws E extends java.lang.Exception
T
- target (mapped) typeS
- source typeE
- exception typeiterable
- iterable providing the source elementsmapper
- mapper converting the source elements into the target elementsE
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <T,S> java.util.HashMap<T,S> mapME(@NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
See mapM(java.util.Map, Iterable, Function)
for a method which allows to define the
result map.
See mapM(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.HashMap<S,T> mapRE(@NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
See mapR(java.util.Map, Iterable, Function)
for a method which allows to define the
result map.
See mapR(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <T,S> java.util.LinkedList<T> mapE(@NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
mapFragile(Object[], FragileFunction1)
instead which
does not require handling a TypeConverterException
See map(java.util.Collection, Object[], Function)
for a method which allows to define the
result collection.
See map(Object[], Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S,E extends java.lang.Exception> java.util.ArrayList<T> mapFragile(@NotNull S[] array, @NotNull FragileFunction1<? extends T,E,? super S> mapper) throws E extends java.lang.Exception
T
- target (mapped) typeS
- source typeE
- exception typearray
- array providing the source elementsmapper
- mapper converting the source elements into the target elementsE
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <T,S,E extends java.lang.Exception> java.util.ArrayList<T> mapFragile(@NotNull java.util.Collection<S> collection, @NotNull FragileFunction1<? extends T,E,? super S> mapper) throws E extends java.lang.Exception
T
- target (mapped) typeS
- source typeE
- exception typecollection
- collection providing the source elementsmapper
- mapper converting the source elements into the target elementsE
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <T,S,E extends java.lang.Exception> java.util.ArrayList<T> mapFragile(@NotNull Countable<S> countable, @NotNull FragileFunction1<? extends T,E,? super S> mapper) throws E extends java.lang.Exception
T
- target (mapped) typeS
- source typeE
- exception typecountable
- countable providing the source elementsmapper
- mapper converting the source elements into the target elementsE
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <T,S,E extends java.lang.Exception> java.util.LinkedList<T> mapFragile(@NotNull java.util.Iterator<S> iterator, @NotNull FragileFunction1<? extends T,E,? super S> mapper) throws E extends java.lang.Exception
T
- target (mapped) typeS
- source typeE
- exception typeiterator
- iterator providing the source elements, consumed after the callmapper
- mapper converting the source elements into the target elementsE
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <T,S,E extends java.lang.Exception> java.util.LinkedList<T> mapFragile(@NotNull java.util.Enumeration<S> enumeration, @NotNull FragileFunction1<? extends T,E,? super S> mapper) throws E extends java.lang.Exception
T
- target (mapped) typeS
- source typeE
- exception typeenumeration
- enumeration providing the source elements, consumed after the callmapper
- mapper converting the source elements into the target elementsE
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <T,S> java.util.HashMap<T,S> mapME(@NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
See mapM(java.util.Map, Object[], Function)
for a method which allows to define the
result map.
See mapM(Object[], Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.HashMap<S,T> mapRE(@NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
See mapR(java.util.Map, Object[], Function)
for a method which allows to define the
result map.
See mapR(Object[], Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <T,S> java.util.LinkedList<T> mapE(@NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
mapFragile(Iterator, FragileFunction1)
instead which
does not require handling a TypeConverterException
See map(java.util.Collection, Iterable, Function)
for a method which allows to define the
result collection.
See map(Iterable, Function, Object)
for a method which allows to discard elements.
See map(Iterable, Function)
for an easy to adapt example.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.HashMap<T,S> mapME(@NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
See mapM(java.util.Map, Iterable, Function)
for a method which allows to define the
result map.
See mapM(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.HashMap<S,T> mapRE(@NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
See mapR(java.util.Map, Iterable, Function)
for a method which allows to define the
result map.
See mapR(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <T,S> java.util.LinkedList<T> mapE(@NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
mapFragile(Enumeration, FragileFunction1)
instead which
does not require handling a TypeConverterException
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.HashMap<T,S> mapME(@NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.HashMap<S,T> mapRE(@NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<? super T>,T,S> C mapXE(@NotNull C target, @NotNull S[] array, @NotNull FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter) throws TypeConverterException
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<? super T>,T,S> C mapXE(@NotNull C target, @NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter) throws TypeConverterException
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<? super T>,T,S> C mapXE(@NotNull C target, @NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter) throws TypeConverterException
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
See map(java.util.Collection, Iterable, Function)
for an easy to adapt example.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<? super T>,T,S> C mapXE(@NotNull C target, @NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter) throws TypeConverterException
This will add all mapped elements to the target collection.
See map(java.util.Collection, Iterable, Function, Object)
for a method
which allows to discard elements.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
See map(java.util.Collection, Iterable, Function)
for an easy to adapt example.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.LinkedList<T> mapXE(@NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter) throws TypeConverterException
See map(java.util.Collection, Iterable, Function)
for a method which allows to define the
result collection.
See map(Iterable, Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.LinkedList<T> mapXE(@NotNull S[] array, @NotNull FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter) throws TypeConverterException
See map(java.util.Collection, Object[], Function)
for a method which allows to define the
result collection.
See map(Object[], Function, Object)
for a method which allows to discard elements.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.LinkedList<T> mapXE(@NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter) throws TypeConverterException
See map(java.util.Collection, Iterable, Function)
for a method which allows to define the
result collection.
See map(Iterable, Function, Object)
for a method which allows to discard elements.
See map(Iterable, Function)
for an easy to adapt example.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.LinkedList<T> mapXE(@NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<? extends java.lang.Iterable<T>,? super S> typeConverter) throws TypeConverterException
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsTypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <C extends java.util.Collection<? super T>,T,S> C mapE(@NotNull C target, @NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
mapFragile(Collection, Object[], FragileFunction1, Object)
instead which
does not require handling a TypeConverterException
This method allows to discard elements during the mapping.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> C mapFragile(@NotNull C target, @NotNull S[] array, @NotNull FragileFunction1<? extends T,E,? super S> mapper, @Nullable T deleteMark) throws E extends java.lang.Exception
This method allows to discard elements during the mapping.
C
- collection typeT
- target (mapped) typeS
- source typeE
- exception typetarget
- collection where the mapped elements are addedarray
- array providing the source elementsmapper
- fragile mapper for converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.E
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapME(@NotNull M target, @NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapRE(@NotNull M target, @NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedarray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <C extends java.util.Collection<? super T>,T,S> C mapE(@NotNull C target, @NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
mapFragile(Collection, Iterable, FragileFunction1, Object)
instead which
does not require handling a TypeConverterException
This method allows to discard elements during the mapping.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> C mapFragile(@NotNull C target, @NotNull java.lang.Iterable<S> iterable, @NotNull FragileFunction1<? extends T,E,? super S> mapper, @Nullable T deleteMark) throws E extends java.lang.Exception
This method allows to discard elements during the mapping.
C
- collection typeT
- target (mapped) typeS
- source typeE
- exception typetarget
- collection where the mapped elements are addediterable
- iterable providing the source elementsmapper
- fragile mapper for converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.E
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapME(@NotNull M target, @NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (converted) typeS
- source typetarget
- map where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapRE(@NotNull M target, @NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
Note that target and iterable are not allowed to be the same object, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (converted) typeS
- source typetarget
- map where the mapped elements are addediterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <C extends java.util.Collection<? super T>,T,S> C mapE(@NotNull C target, @NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
mapFragile(Collection, Iterator, FragileFunction1, Object)
instead which
does not require handling a TypeConverterException
This method allows to discard elements during the mapping.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> C mapFragile(@NotNull C target, @NotNull java.util.Iterator<S> iterator, @NotNull FragileFunction1<? extends T,E,? super S> mapper, @Nullable T deleteMark) throws E extends java.lang.Exception
This method allows to discard elements during the mapping.
C
- collection typeT
- target (mapped) typeS
- source typeE
- exception typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementsmapper
- fragile mapper for converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.E
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapME(@NotNull M target, @NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapRE(@NotNull M target, @NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addediterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <C extends java.util.Collection<? super T>,T,S> C mapE(@NotNull C target, @NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
mapFragile(Collection, Enumeration, FragileFunction1, Object)
instead which
does not require handling a TypeConverterException
This method allows to discard elements during the mapping.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- target (mapped) typeS
- source typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <C extends java.util.Collection<T>,T,S,E extends java.lang.Exception> C mapFragile(@NotNull C target, @NotNull java.util.Enumeration<S> enumeration, @NotNull FragileFunction1<? extends T,E,? super S> mapper, @Nullable T deleteMark) throws E extends java.lang.Exception
This method allows to discard elements during the mapping.
C
- collection typeT
- target (mapped) typeS
- source typeE
- exception typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementsmapper
- fragile mapper for converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.E
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <M extends java.util.Map<? super T,? super S>,T,S> M mapME(@NotNull M target, @NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <M extends java.util.Map<? super S,? super T>,T,S> M mapRE(@NotNull M target, @NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
Note that enumeration is not allowed to be an enumeration of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
M
- map typeT
- target (mapped) typeS
- source typetarget
- map where the mapped elements are addedenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <T,S> java.util.LinkedList<T> mapE(@NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
mapFragile(Object[], FragileFunction1, Object)
instead which
does not require handling a TypeConverterException
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S,E extends java.lang.Exception> java.util.ArrayList<T> mapFragile(@NotNull S[] array, @NotNull FragileFunction1<? extends T,E,? super S> mapper, @Nullable T deleteMark) throws E extends java.lang.Exception
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeE
- exception typearray
- array providing the source elementsmapper
- fragile mapper for converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.E
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <T,S> java.util.HashMap<T,S> mapME(@NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.HashMap<S,T> mapRE(@NotNull S[] array, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typearray
- array providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <T,S> java.util.LinkedList<T> mapE(@NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
mapFragile(Iterable, FragileFunction1, Object)
instead which
does not require handling a TypeConverterException
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S,E extends java.lang.Exception> java.util.LinkedList<T> mapFragile(@NotNull java.lang.Iterable<S> iterable, @NotNull FragileFunction1<? extends T,E,? super S> mapper, @Nullable T deleteMark) throws E extends java.lang.Exception
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeE
- exception typeiterable
- iterable providing the source elementsmapper
- fragile mapper for converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.E
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <T,S> java.util.HashMap<T,S> mapME(@NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.HashMap<S,T> mapRE(@NotNull java.lang.Iterable<S> iterable, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The incoming values will become keys, pointing to the associated convereted values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterable
- iterable providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <T,S> java.util.LinkedList<T> mapE(@NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
mapFragile(Iterator, FragileFunction1, Object)
instead which
does not require handling a TypeConverterException
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S,E extends java.lang.Exception> java.util.LinkedList<T> mapFragile(@NotNull java.util.Iterator<S> iterator, @NotNull FragileFunction1<? extends T,E,? super S> mapper, @Nullable T deleteMark) throws E extends java.lang.Exception
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeE
- exception typeiterator
- iterator providing the source elementsmapper
- fragile mapper for converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.E
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <T,S> java.util.HashMap<T,S> mapME(@NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.HashMap<S,T> mapRE(@NotNull java.util.Iterator<S> iterator, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeiterator
- iterator providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull @Deprecated public static <T,S> java.util.LinkedList<T> mapE(@NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
mapFragile(Enumeration, FragileFunction1, Object)
instead which
does not require handling a TypeConverterException
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S,E extends java.lang.Exception> java.util.LinkedList<T> mapFragile(@NotNull java.util.Enumeration<S> enumeration, @NotNull FragileFunction1<? extends T,E,? super S> mapper, @Nullable T deleteMark) throws E extends java.lang.Exception
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeE
- exception typeenumeration
- enumeration providing the source elementsmapper
- fragile mapper for converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.E
- if the mapper throwsE extends java.lang.Exception
@NotNull public static <T,S> java.util.HashMap<T,S> mapME(@NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The converted values will become keys, pointing to the associated incoming values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
@NotNull public static <T,S> java.util.HashMap<S,T> mapRE(@NotNull java.util.Enumeration<S> enumeration, @NotNull FragileTypeConverter<T,? super S> typeConverter, @Nullable T deleteMark) throws TypeConverterException
The incoming values will become keys, pointing to the associated converted values.
This method allows to discard elements during the mapping.
T
- target (mapped) typeS
- source typeenumeration
- enumeration providing the source elementstypeConverter
- type converter converting the source elements into the mapped elementsdeleteMark
- special return value of the type converter which means not to copy
the result into the target collection. It is compared with reference
equality. Often null
is a useful choice, only in cases
where the target collection may contain null
values and the
type converter may produce them another mark is necessary.TypeConverterException
- if the conversion fails with an exception,
the thrown exception will provide this original exception
as TypeConverterException.getException()
public static <T> void forEach(@NotNull T[] array, @NotNull LoopItemHandler<? super T> handler)
T
- item typearray
- array to loop overhandler
- item handler which is called for each itempublic static <T,E extends java.lang.Exception> void forEach(@NotNull T[] array, @NotNull FragileLoopItemHandler<? super T,E> handler) throws E extends java.lang.Exception
T
- item typeE
- exception typearray
- array to loop overhandler
- item handler which is called for each itemE
- exception thrown by handlerE extends java.lang.Exception
public static <T> void forEach(@NotNull java.lang.Iterable<T> iterable, @NotNull LoopItemHandler<? super T> handler)
T
- item typeiterable
- iterable to loop overhandler
- item handler which is called for each itempublic static <T,E extends java.lang.Exception> void forEach(@NotNull java.lang.Iterable<T> iterable, @NotNull FragileLoopItemHandler<? super T,E> handler) throws E extends java.lang.Exception
T
- item typeE
- exception thrown by handleriterable
- iterable to loop overhandler
- item handler which is called for each itemE
- exception thrown by handlerE extends java.lang.Exception
public static <T> void forEach(@NotNull java.util.Iterator<T> iterator, @NotNull LoopItemHandler<? super T> handler)
T
- item typeiterator
- iterator to loop overhandler
- item handler which is called for each itempublic static <T,E extends java.lang.Exception> void forEach(@NotNull java.util.Iterator<T> iterator, @NotNull FragileLoopItemHandler<? super T,E> handler) throws E extends java.lang.Exception
T
- item typeE
- exception thrown by handleriterator
- iterator to loop overhandler
- item handler which is called for each itemE
- exception thrown by handlerE extends java.lang.Exception
public static <T> void forEach(@NotNull java.util.Enumeration<T> enumeration, @NotNull LoopItemHandler<? super T> handler)
T
- item typeenumeration
- enumeration to loop overhandler
- item handler which is called for each itempublic static <T,E extends java.lang.Exception> void forEach(@NotNull java.util.Enumeration<T> enumeration, @NotNull FragileLoopItemHandler<? super T,E> handler) throws E extends java.lang.Exception
T
- item typeE
- exception thrown by handlerenumeration
- enumeration to loop overhandler
- item handler which is called for each itemE
- exception thrown by handlerE extends java.lang.Exception
public static <T,E extends java.lang.Exception> void forEachFragile(@NotNull java.lang.Iterable<T> iterable, @NotNull FragileProcedure1<E,? super T> consumer) throws E extends java.lang.Exception
Iterable.forEach(Consumer)
when the consumer is defined with
a checked exception.T
- element typeE
- exception typeiterable
- iterable to iterate overconsumer
- consumer called for each iterated elementE
- forwarded exception of the consumerE extends java.lang.Exception
public static <T,E extends java.lang.Exception> void forEachRemainingFragile(@NotNull java.util.Iterator<T> iterator, @NotNull FragileProcedure1<E,? super T> consumer) throws E extends java.lang.Exception
Iterator.forEachRemaining(Consumer)
when the consumer is defined with
a checked exception.T
- element typeE
- exception typeiterator
- iterator for which all remaining elements are consumedconsumer
- consumer called for each remaining elementE
- forwarded exception of the consumerE extends java.lang.Exception
@NotNull public static <T,E extends java.lang.Exception,L extends FragileLoopItemHandler<T,E>> CarelessLoopItemHandler<T,E,L> toLoopItemHandler(L handler)
T
- item typeE
- exception typeL
- careful loop item handler typehandler
- handler to wrap@NotNull @SafeVarargs public static <T> java.util.List<T> asList(@NotNull T... array)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list returned from this method, so the safest use is as a temporary object.
public void method(Collection<Double> input) { // ... } // ... method(Types.asList(0, 7.1, -42, Math.PI));
T
- element type of array and listarray
- the array to wrap into a list view@NotNull public static <T> java.util.List<T> asList(@NotNull T[] array, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
See asList(Object[])
for an easy to adapt example.
T
- element type of array and listarray
- the array to wrap into a list viewlength
- the number of elements to be used from the array@NotNull public static <T> java.util.List<T> asList(@NotNull T[] array, int start, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method.
See asList(Object[])
for an easy to adapt example.
T
- element type of array and listarray
- the array to wrap into a list viewstart
- index of first used element of the arraylength
- the number of elements to be used from the array@NotNull public static boolean[] toBooleanArray(@NotNull java.util.Collection<java.lang.Boolean> c)
Boolean
s to a raw array of booleans.c
- collection of BooleansBooleanIndexable.viewList(List)
public static boolean[] toBooleanArray(@NotNull Countable<java.lang.Boolean> c)
Boolean
s to a raw array of booleans.c
- collection of Booleans@NotNull public static <T> java.util.LinkedList<T> toList(@NotNull java.util.Enumeration<T> enumeration)
T
- type of enumeration and result list elementsenumeration
- enumeration to convertaddAll(Collection, Enumeration)
@NotNull public static <T> java.util.LinkedList<T> toList(@NotNull java.util.Iterator<T> iterator)
T
- type of iterator and result list elementsiterator
- iterator to convertaddAll(Collection, Iterator)
@NotNull public static <T> java.util.LinkedList<T> toList(@NotNull java.lang.Iterable<T> iterable)
T
- type of iterable and result list elementsiterable
- iterable to convertaddAll(Collection, Iterable)
@NotNull public static java.util.LinkedList<java.lang.String> toStringList(@NotNull java.util.Enumeration<?> enumeration)
Object.toString()
,
on its elements, so it can no longer be enumerated after calling this method.enumeration
- enumeration to convert@NotNull public static java.util.LinkedList<java.lang.String> toStringList(@NotNull java.util.Iterator<?> iterator)
Object.toString()
,
on its elements, so it can no longer be iterated over after calling this method.iterator
- iterator to convert@NotNull public static java.util.LinkedList<java.lang.String> toStringList(@NotNull java.lang.Iterable<?> iterable)
Object.toString()
on its elementsiterable
- iterable to convert@NotNull public static java.util.List<java.lang.Boolean> toList(@NotNull boolean... array)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
public void method(Collection<Double> input) { // ... } // ... method(Types.toList(0, 7.1, -42, Math.PI));
array
- the array to wrap into a list view@NotNull public static java.util.List<java.lang.Boolean> toList(@NotNull boolean[] array, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewlength
- the number of elements to be used from the array@NotNull public static java.util.List<java.lang.Boolean> toList(@NotNull boolean[] array, int start, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewstart
- index of first used element of the arraylength
- the number of elements to be used from the array@NotNull public static byte[] toByteArray(@NotNull java.util.Collection<? extends java.lang.Number> c)
Number
s to a raw array of bytes.c
- collection of NumbersByteIndexable.viewList(List)
@NotNull public static byte[] toByteArray(@NotNull Countable<? extends java.lang.Number> c)
Number
s to a raw array of bytes.c
- collection of Numberspublic static byte[] toByteArray(int... bytes)
bytes
- values which will be converted into bytes@NotNull public static java.util.List<java.lang.Byte> toList(@NotNull byte... array)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
array
- the array to wrap into a list view@NotNull public static java.util.List<java.lang.Byte> toList(@NotNull byte[] array, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewlength
- the number of elements to be used from the array@NotNull public static java.util.List<java.lang.Byte> toList(@NotNull byte[] array, int start, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewstart
- index of first used element of the arraylength
- the number of elements to be used from the array@NotNull public static short[] toShortArray(@NotNull java.util.Collection<? extends java.lang.Number> c)
Number
s to a raw array of shorts.c
- collection of NumbersShortIndexable.viewList(List)
public static short[] toShortArray(@NotNull Countable<? extends java.lang.Number> c)
Number
s to a raw array of shorts.c
- countable of Numbers@NotNull public static java.util.List<java.lang.Short> toList(@NotNull short... array)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
array
- the array to wrap into a list viewShortIndexable.viewArray(short...)
@NotNull public static java.util.List<java.lang.Short> toList(@NotNull short[] array, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewlength
- the number of elements to be used from the array@NotNull public static java.util.List<java.lang.Short> toList(@NotNull short[] array, int start, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewstart
- index of first used element of the arraylength
- the number of elements to be used from the arrayShortIndexable.viewArray(short[], int, int)
public static int[] toIntArray(@NotNull java.util.Collection<? extends java.lang.Number> c)
Number
s to a raw array of ints.c
- collection of NumbersIntIndexable.viewList(List)
public static int[] toIntArray(@NotNull Countable<? extends java.lang.Number> c)
Number
s to a raw array of ints.c
- countable Numbers@NotNull public static java.util.List<java.lang.Integer> toList(@NotNull int... array)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
public void method(Collection<Integer> input) { // ... } // ... method(Types.asList(0, 7, -42, 3));
array
- the array to wrap into a list viewIntIndexable.viewArray(int...)
@NotNull public static java.util.List<java.lang.Integer> toList(@NotNull int[] array, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewlength
- the number of elements to be used from the array@NotNull public static java.util.List<java.lang.Integer> toList(@NotNull int[] array, int start, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewstart
- index of first used element of the arraylength
- the number of elements to be used from the arrayIntIndexable.viewArray(int[], int, int)
public static long[] toLongArray(@NotNull java.util.Collection<? extends java.lang.Number> c)
Number
s to a raw array of long ints.c
- collection of Numberspublic static long[] toLongArray(@NotNull Countable<? extends java.lang.Number> c)
Number
s to a raw array of long ints.c
- countable Numbers@NotNull public static java.util.List<java.lang.Long> toList(@NotNull long... array)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
public void method(Collection(<Long> input) { // ... } // ... method(Types.toList(0L, 7L, -42L, 3L));
array
- the array to wrap into a list viewLongIndexable.viewArray(long...)
@NotNull public static java.util.List<java.lang.Long> toList(@NotNull long[] array, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewlength
- the number of elements to be used from the array@NotNull public static java.util.List<java.lang.Long> toList(@NotNull long[] array, int start, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewstart
- index of first used element of the arraylength
- the number of elements to be used from the arrayLongIndexable.viewArray(long[], int, int)
@NotNull public static double[] toDoubleArray(@NotNull java.util.Collection<? extends java.lang.Number> c)
Number
s to a raw array of doubles.c
- collection of Numbers@NotNull public static double[] toDoubleArray(@NotNull Countable<? extends java.lang.Number> c)
Number
s to a raw array of doubles.c
- countable Numbers@NotNull public static java.util.List<java.lang.Double> toList(@NotNull double... array)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
public void method(Collection<Double> input) { // ... } // ... method(Types.toList(0.0, 7.1, -42.0, Math.PI));
array
- the array to wrap into a list viewDoubleIndexable.viewArray(double...)
@NotNull public static java.util.List<java.lang.Double> toList(@NotNull double[] array, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewlength
- the number of elements to be used from the array@NotNull public static java.util.List<java.lang.Double> toList(@NotNull double[] array, int start, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewstart
- index of first used element of the arraylength
- the number of elements to be used from the arrayDoubleIndexable.viewArray(double[], int, int)
@NotNull public static float[] toFloatArray(@NotNull java.util.Collection<? extends java.lang.Number> c)
Number
s to a raw array of floats.c
- collection of Numbers@NotNull public static float[] toFloatArray(@NotNull Countable<? extends java.lang.Number> c)
Number
s to a raw array of floats.c
- countable Numbers@NotNull public static java.util.List<java.lang.Float> toList(@NotNull float... array)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
array
- the array to wrap into a list viewFloatIndexable.viewArray(float...)
@NotNull public static java.util.List<java.lang.Float> toList(@NotNull float[] array, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method, so the safest use is as a temporary object.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewlength
- the number of elements to be used from the array@NotNull public static java.util.List<java.lang.Float> toList(@NotNull float[] array, int start, int length)
Arrays.asList()
,
useful if only an unmodifiable list is needed.
Changes of the array will be reflected in the list return from this method.
See asList(Object[])
for an easy to adapt example.
array
- the array to wrap into a list viewstart
- index of first used element of the arraylength
- the number of elements to be used from the arrayFloatIndexable.viewArray(float[], int, int)
@NotNull @SafeVarargs public static <T> java.util.Enumeration<T> toEnumeration(@NotNull T... item)
T
- enumeration typeitem
- items@NotNull public static <T> java.util.Enumeration<T> toEnumeration(@NotNull java.lang.Iterable<T> iterable)
T
- iterator typeiterable
- the iterable@NotNull public static <T> java.util.Enumeration<T> toEnumeration(@NotNull java.util.Iterator<T> iterator)
T
- iterator typeiterator
- the iterator@NotNull public static <T> java.util.Iterator<T> toIterator(@NotNull java.util.Enumeration<T> enumeration)
T
- enumeration typeenumeration
- the enumeration@NotNull @SafeVarargs public static <T> java.util.Iterator<T> toIterator(@NotNull T... item)
T
- item typeitem
- items@NotNull public static <T> java.lang.Iterable<T> toIterable(@NotNull java.util.Enumeration<T> enumeration)
T
- item typeenumeration
- enumeration to wrappublic static <T> boolean containsEquals(@NotNull java.lang.Iterable<T> collection, @NotNull T element)
contains()
method is sometimes erroneously checking for reference equality,
while this method uses the equals()
method.
As this method has to use an iterator its efficiency is determined by the size of the
collection and the time for equality checking of the element.T
- generic parametercollection
- collectionelement
- element which is looked uptrue
if an element which is equal to the given one is contained in the collectionfalse
otherwise@Nullable public static <T> T findFirst(@NotNull java.lang.Iterable<T> iterable, @NotNull java.util.function.Predicate<? super T> check)
T
- generic parameteriterable
- iterable with possibly matching elementscheck
- check to performnull
if no matching element was found@Nullable public static <T> T findNext(@NotNull java.util.Iterator<T> iterator, @NotNull java.util.function.Predicate<? super T> check)
T
- generic parameteriterator
- iterator which is advanced until the given element is foundcheck
- check to performnull
if no matching element was found@Nullable public static <T> T findNext(@NotNull java.util.Enumeration<T> enumeration, @NotNull java.util.function.Predicate<? super T> check)
T
- generic parameterenumeration
- enumeration which is advanced until the given element is foundcheck
- check to performnull
if no matching element was foundpublic static <T> int findFirstEqual(@NotNull java.lang.Iterable<T> collection, @NotNull T element)
indexOf()
method is sometimes erroneously checking for reference equality,
while this method uses the equals()
method.
As this method has to use an iterator its efficiency is determined by the size of the
collection and the time for equality checking of the element.T
- generic parametercollection
- collectionelement
- element which is looked uptrue
if an element which is equal to the given one is contained in the collectionfalse
otherwisepublic static <T,E> int findFirstMatch(@NotNull java.lang.Iterable<T> collection, @NotNull E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- generic parameter for iteratorE
- generic parameter for looked up elementcollection
- collectionelement
- element which is looked upmatcher
- matcher which matches the elements in the iteration to the given elementtrue
if an element which is equal to the given one is contained in the collectionfalse
otherwise@NotNull @SafeVarargs public static <C extends java.util.Collection<? super T>,T> C addAll(@NotNull C collection, T... elements)
C
- collection typeT
- element typecollection
- collection to add to, has to be modifiableelements
- elements to addCollections.addAll(Collection, Object[])
@NotNull public static <C extends java.util.Collection<T>,T> C addAll(@NotNull C collection, @NotNull java.lang.Iterable<? extends T> iterable)
C
- collection typeT
- collection/iterator typecollection
- collection to add to, has to be modifiableiterable
- iterable to add@Deprecated @NotNull public static <C extends java.util.Collection<T>,T> C addIterable(@NotNull C collection, @NotNull java.lang.Iterable<? extends T> iterable)
addAll(Collection, Iterable)
insteadC
- collection typeT
- collection/iterator typecollection
- collection to add to, has to be modifiableiterable
- iterable to add@NotNull @Deprecated public static <C extends java.util.Collection<T>,T> C addIterator(@NotNull C collection, @NotNull java.util.Iterator<? extends T> iterator)
addAll(Collection, Iterator)
insteadC
- collection typeT
- collection/iterator typecollection
- collection to add to, has to be modifiableiterator
- iterator to add@NotNull public static <C extends java.util.Collection<T>,T> C addAll(@NotNull C collection, @NotNull java.util.Iterator<? extends T> iterator)
C
- collection typeT
- collection/iterator typecollection
- collection to add to, has to be modifiableiterator
- iterator to add@NotNull @Deprecated public static <C extends java.util.Collection<T>,T> C addEnumeration(@NotNull C collection, @NotNull java.util.Enumeration<? extends T> enumeration)
addAll(Collection, Enumeration)
insteadC
- collection typeT
- collection/iterator typecollection
- collection to add to, has to be modifiableenumeration
- enumeration to add@NotNull public static <C extends java.util.Collection<T>,T> C addAll(@NotNull C collection, @NotNull java.util.Enumeration<? extends T> enumeration)
C
- collection typeT
- collection/iterator typecollection
- collection to add to, has to be modifiableenumeration
- enumeration to add@NotNull public static <T> java.util.LinkedList<T> makeList(@NotNull java.lang.Iterable<T> iterable)
T
- iterable/list typeiterable
- iterable@NotNull public static <T> java.util.LinkedList<T> makeList(@NotNull java.util.Iterator<T> iterator)
T
- iterator/list typeiterator
- iterator@NotNull public static <T> java.util.LinkedList<T> makeList(@NotNull java.util.Enumeration<T> enumeration)
T
- enumeration/list typeenumeration
- enumeration@NotNull public static <K,V> java.util.ArrayList<OrderedPair<K,V>> toPairs(@NotNull java.util.Map<K,V> map)
K
- map key / first pair value typeV
- map value / second pair value typemap
- map to convert@NotNull public static <K,V,C extends java.util.Collection<OrderedPair<K,V>>> C toPairs(@NotNull C target, @NotNull java.util.Map<K,V> map)
K
- map key / first pair value typeV
- map value / second pair value typeC
- collection typetarget
- collection where the pairs are addedmap
- map to convert@NotNull public static <T> java.util.Collection<T> synchronizedCollection(@NotNull java.util.Collection<T> collection)
To make the synchronization work it is adamant that the basic collection is never accessed directly, only via
the returned collection. Different from Collections.synchronizedCollection(java.util.Collection)
special handling for iterations is not necessary.
T
- element typecollection
- basic collectionSynchronizedCollection
public static <T> java.util.List<T> synchronizedList(@NotNull java.util.List<T> list)
To make the synchronization work it is adamant that the basic list is never accessed directly, only via
the returned list. Different from Collections.synchronizedList(List)
special handling for iterations is not necessary.
T
- element typelist
- basic listSynchronizedList
@NotNull public static <T> java.util.LinkedList<T> extract(@NotNull java.lang.Object[] array, @NotNull java.lang.Class<T> targetType)
Internally this is using reflection, namely the Class.isInstance(Object)
method,
which is not considered fast. If you need this method often, rethink your design.
Compare extract(Iterable, Class)
for an easily adaptable example.
T
- target typearray
- array with arbitrary elementstargetType
- type of elements which shall be extracted@NotNull public static <T,C extends java.util.Collection<? super T>> C extract(@NotNull C target, @NotNull java.lang.Object[] array, @NotNull java.lang.Class<T> targetType)
Internally this is using reflection, namely the Class.isInstance(Object)
method,
which is not considered fast. If you need this method often, rethink your design.
Compare extract(Iterable, Class)
for an easily adaptable example.
T
- target typeC
- target collection typetarget
- target collectionarray
- array with arbitrary elementstargetType
- type of elements which shall be extracted@NotNull public static <T> java.util.LinkedList<T> extract(@NotNull java.lang.Iterable<?> iterable, @NotNull java.lang.Class<T> targetType)
Internally this is using reflection, namely the Class.isInstance(Object)
method,
which is not considered fast. If you need this method often, rethink your design.
Example:
public Collection<String> getStrings(Collection<?> collection) { return Types.extract(collection, String.class); }
T
- target typeiterable
- iterable with arbitrary elementstargetType
- type of elements which shall be extracted@NotNull public static <T,C extends java.util.Collection<? super T>> C extract(@NotNull C target, @NotNull java.lang.Iterable<?> iterable, @NotNull java.lang.Class<T> targetType)
Internally this is using reflection, namely the Class.isInstance(Object)
method,
which is not considered fast. If you need this method often, rethink your design.
Compare extract(Iterable, Class)
for an easily adaptable example.
T
- target typeC
- target collection typetarget
- target collectioniterable
- iterable with arbitrary elementstargetType
- type of elements which shall be extracted@NotNull public static <T> java.util.LinkedList<T> extract(@NotNull java.util.Iterator<?> iterator, @NotNull java.lang.Class<T> targetType)
Internally this is using reflection, namely the Class.isInstance(Object)
method,
which is not considered fast. If you need this method often, rethink your design.
Compare extract(Iterable, Class)
for an easily adaptable example.
T
- target typeiterator
- iterator with arbitrary elementstargetType
- type of elements which shall be extracted@NotNull public static <T,C extends java.util.Collection<? super T>> C extract(@NotNull C target, @NotNull java.util.Iterator<?> iterator, @NotNull java.lang.Class<T> targetType)
Internally this is using reflection, namely the Class.isInstance(Object)
method,
which is not considered fast. If you need this method often, rethink your design.
Compare extract(Iterable, Class)
for an easily adaptable example.
T
- target typeC
- target collection typetarget
- target collectioniterator
- iterator with arbitrary elementstargetType
- type of elements which shall be extracted@NotNull public static <T> java.util.LinkedList<T> extract(@NotNull java.util.Enumeration<?> enumeration, @NotNull java.lang.Class<T> targetType)
Internally this is using reflection, namely the Class.isInstance(Object)
method,
which is not considered fast. If you need this method often, rethink your design.
Compare extract(Iterable, Class)
for an easily adaptable example.
T
- target typeenumeration
- enumeration with arbitrary elementstargetType
- type of elements which shall be extracted@NotNull public static <T,C extends java.util.Collection<? super T>> C extract(@NotNull C target, @NotNull java.util.Enumeration<?> enumeration, @NotNull java.lang.Class<T> targetType)
Internally this is using reflection, namely the Class.isInstance(Object)
method,
which is not considered fast. If you need this method often, rethink your design.
Compare extract(Iterable, Class)
for an easily adaptable example.
T
- target typeC
- target collection typetarget
- target collectionenumeration
- enumeration with arbitrary elementstargetType
- type of elements which shall be extractedpublic static <T1,T2> boolean areEqual(@NotNull java.util.Collection<T1> c1, @NotNull java.util.Collection<T2> c2)
This uses the equals()
method of objects of the first collection
for equality checking.
Both collections are iterated over in order, so if both contain the same elements, but in different
orders, they are considered different.
T1
- type of first collectionT2
- type of second collectionc1
- first collectionc2
- second collectiontrue
if both collections are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull java.util.Collection<T1> c1, @NotNull java.util.Collection<T2> c2, @NotNull java.util.function.BiPredicate<? super T1,? super T2> matcher)
Both collections are iterated over in order, so if both contain the same elements, but in different orders, they are considered different.
T1
- type of first collectionT2
- type of second collectionc1
- first collectionc2
- second collectionmatcher
- matcher for equality checkingtrue
if both collection are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull Countable<T1> c1, @NotNull Countable<T2> c2)
This uses the equals()
method of objects of the first countabel
for equality checking.
Both countables are iterated over in order, so if both contain the same elements, but in different
orders, they are considered different.
T1
- type of first countableT2
- type of second countablec1
- first countablec2
- second countabletrue
if both countables are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull Countable<T1> c1, @NotNull Countable<T2> c2, @NotNull java.util.function.BiPredicate<? super T1,? super T2> matcher)
Both countables are iterated over in order, so if both contain the same elements, but in different orders, they are considered different.
T1
- type of first countableT2
- type of second countablec1
- first countablec2
- second countablematcher
- matcher for equality checkingtrue
if both countable are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull T1[] arr1, @NotNull T2[] arr2)
This uses the equals()
method of objects of the first array
for equality checking.
Both arrays are iterated over in order, so if both contain the same elements, but in different
orders, they are considered different.
T1
- type of first arrayT2
- type of second arrayarr1
- first arrayarr2
- second arraytrue
if both arrays are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull T1[] arr1, @NotNull T2[] arr2, @NotNull java.util.function.BiPredicate<? super T1,? super T2> matcher)
Both arrays are iterated over in order, so if both contain the same elements, but in different orders, they are considered different.
T1
- type of first arrayT2
- type of second arrayarr1
- first arrayarr2
- second arraymatcher
- matcher for equality checkingtrue
if both arrays are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull java.lang.Iterable<T1> it1, @NotNull java.lang.Iterable<T2> it2)
This uses the equals()
method of objects of the first iterable
for equality checking.
Both iterables are iterated over in order, so if both contain the same elements, but in different
orders, they are considered different.
T1
- type of first iterableT2
- type of second iterableit1
- first iterableit2
- second iterabletrue
if both iterables are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull java.lang.Iterable<T1> it1, @NotNull java.lang.Iterable<T2> it2, @NotNull java.util.function.BiPredicate<? super T1,? super T2> matcher)
Both iterables are iterated over in order, so if both contain the same elements, but in different orders, they are considered different.
T1
- type of first iterableT2
- type of second iterableit1
- first iterableit2
- second iterablematcher
- matcher for equality checkingtrue
if both iterables are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull java.util.Iterator<T1> it1, @NotNull java.util.Iterator<T2> it2)
This uses the equals()
method of objects of the first iterator
for equality checking.
Both iterators are iterated over in order, so if both contain the same elements, but in different
orders, they are considered different.
T1
- type of first iteratorT2
- type of second iteratorit1
- first iteratorit2
- second iteratortrue
if both iterators are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull java.util.Iterator<T1> it1, @NotNull java.util.Iterator<T2> it2, @NotNull java.util.function.BiPredicate<? super T1,? super T2> matcher)
Both iterators are iterated over in order, so if both contain the same elements, but in different orders, they are considered different.
T1
- type of first iteratorT2
- type of second iteratorit1
- first iteratorit2
- second iteratormatcher
- matcher for equality checkingtrue
if both iterators are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull java.util.Enumeration<T1> en1, @NotNull java.util.Enumeration<T2> en2)
This uses the equals()
method of objects of the first enumeration
for equality checking.
Both iterators are iterated over in order, so if both contain the same elements, but in different
orders, they are considered different.
T1
- type of first enumerationT2
- type of second enumerationen1
- first enumerationen2
- second enumerationtrue
if both enumerations are equalfalse
if they are differentpublic static <T1,T2> boolean areEqual(@NotNull java.util.Enumeration<T1> en1, @NotNull java.util.Enumeration<T2> en2, @NotNull java.util.function.BiPredicate<? super T1,? super T2> matcher)
This uses the equals()
method of objects of the first enumeration
for equality checking.
Both iterators are iterated over in order, so if both contain the same elements, but in different
orders, they are considered different.
T1
- type of first enumerationT2
- type of second enumerationen1
- first enumerationen2
- second enumerationmatcher
- matcher for equality checkingtrue
if both enumerations are equalfalse
if they are differentpublic static <T> T get(@NotNull java.lang.Iterable<T> iterable, int index)
T
- type of iterableiterable
- iterableindex
- index of requested elementjava.lang.IndexOutOfBoundsException
- if index is invalidpublic static <T,E> int indexOf(@NotNull T[] array, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- type of iterableE
- type of elementarray
- array to iterate overelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checking-1
if no element was found, otherwise the index of the element (i.e. the number of
iterations minus one)public static <T,E> int indexOf(@NotNull T[] array, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher, int start)
T
- type of iterableE
- type of elementarray
- array to iterate overelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checkingstart
- index where to start the search-1
if no element was found, otherwise the index of the element (i.e. the number of
iterations minus one)public static <T,E> int indexOf(@NotNull java.lang.Iterable<T> iterable, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- type of iterableE
- type of elementiterable
- iterable to iterate overelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checking-1
if no element was found, otherwise the index of the element (i.e. the number of
iterations minus one)public static <T,E> int indexOf(@NotNull java.lang.Iterable<T> iterable, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher, int start)
T
- type of iterableE
- type of elementiterable
- iterable to iterate overelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checkingstart
- index where to start the search-1
if no element was found, otherwise the index of the element (i.e. the number of
iterations minus one)public static <T,E> int indexOf(@NotNull java.util.Iterator<T> iterator, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- type of iteratorE
- type of elementiterator
- iterator to iterate overelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checking-1
if no element was found, otherwise the index of the elementpublic static <T,E> int indexOf(@NotNull java.util.Iterator<T> iterator, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher, int start)
T
- type of iteratorE
- type of elementiterator
- iterator to iterate overelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checkingstart
- index where to start the search-1
if no element was found, otherwise the index of the elementpublic static <T,E> int indexOf(@NotNull java.util.Enumeration<T> enumeration, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- type of enumerationE
- type of elementenumeration
- enumeration to iterate overelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checking-1
if no element was found, otherwise the index of the elementpublic static <T,E> int indexOf(@NotNull java.util.Enumeration<T> enumeration, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher, int start)
T
- type of enumerationE
- type of elementenumeration
- enumeration to iterate overelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checkingstart
- index where to start the search-1
if no element was found, otherwise the index of the elementpublic static <T,E> int indexOf(@NotNull java.util.List<T> list, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher, int start)
T
- type of listE
- type of elementlist
- list to search throughelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checkingstart
- index where to start the search-1
if no element was found, otherwise the index of the elementpublic static <T,E> int lastIndexOf(@NotNull java.util.List<T> list, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher, int start)
T
- type of listE
- type of elementlist
- list to search throughelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checkingstart
- index where to start the search-1
if no element was found, otherwise the index of the elementpublic static <T,E> int lastIndexOf(@NotNull java.util.List<T> list, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- type of listE
- type of elementlist
- list to search throughelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checking-1
if no element was found, otherwise the index of the elementpublic static <T,E> T lastMatch(@NotNull java.util.List<T> list, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher, int start)
T
- type of listE
- type of elementlist
- list to search throughelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checkingstart
- index where to start the searchnull
if no element was found, otherwise the matching element@Nullable public static <T,E> T lastMatch(@NotNull java.util.List<T> list, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- type of listE
- type of elementlist
- list to search throughelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher to use for equality checkingnull
if no element was found, otherwise the matching elementpublic static <T,E> boolean contains(@NotNull T[] array, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- type of iterableE
- type of elementarray
- array which possibly contains an elementelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher for equality checkingtrue
if the element is contained (i.e. the matcher finds a match)false
otherwisepublic static <T,E> boolean contains(@NotNull java.lang.Iterable<T> iterable, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- type of iterableE
- type of elementiterable
- iterable which possibly contains an elementelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher for equality checkingtrue
if the element is contained (i.e. the matcher finds a match)false
otherwisepublic static <T,E> boolean contains(@NotNull java.util.Iterator<T> iterator, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- type of iteratorE
- type of elementiterator
- iterator which possibly contains an elementelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher for equality checkingtrue
if the element is contained (i.e. the matcher finds a match)false
otherwisepublic static <T,E> boolean contains(@NotNull java.util.Enumeration<T> enumeration, E element, @NotNull java.util.function.BiPredicate<? super T,? super E> matcher)
T
- type of iteratorE
- type of elementenumeration
- enumeration which possibly contains an elementelement
- element to look for, whether null
is allowed depends on the matchermatcher
- matcher for equality checkingtrue
if the element is contained (i.e. the matcher finds a match)false
otherwise@NotNull public static <T extends Copyable<T>> java.util.ArrayList<T> copy(@NotNull T[] array)
T
- content typearray
- arraycopy(Collection, Copyable[])
@NotNull public static <T extends Copyable<T>,C extends java.util.Collection<T>> C copy(@NotNull C target, @NotNull T[] array)
T
- content typeC
- target collection typetarget
- target collection where the copies are storedarray
- array@NotNull public static <T extends Copyable<T>> java.util.LinkedList<T> copy(@NotNull java.lang.Iterable<T> iterable)
T
- content typeiterable
- iterable@NotNull public static <T extends Copyable<T>> java.util.ArrayList<T> copy(@NotNull Indexable<T> indexable)
T
- content typeindexable
- indexable collection@NotNull public static <T extends Copyable<T>> java.util.ArrayList<T> copy(@NotNull java.util.Collection<T> collection)
T
- content typecollection
- collection@NotNull public static <T extends Copyable<T>> java.util.ArrayList<T> copy(@NotNull Countable<T> countable)
T
- content typecountable
- countable@NotNull public static <T extends Copyable<T>,C extends java.util.Collection<T>> C copy(@NotNull C target, @NotNull java.lang.Iterable<T> iterable)
T
- content typeC
- target collection typetarget
- target collection where the copies are storediterable
- iterable@NotNull public static <T extends Copyable<T>> java.util.LinkedList<T> copy(@NotNull java.util.Iterator<T> iterator)
T
- content typeiterator
- iterator@NotNull public static <T extends Copyable<T>,C extends java.util.Collection<T>> C copy(@NotNull C target, @NotNull java.util.Iterator<T> iterator)
T
- content typeC
- target collection typetarget
- target collection where the copies are storediterator
- iterator@NotNull public static <T extends Copyable<T>> java.util.LinkedList<T> copy(@NotNull java.util.Enumeration<T> enumeration)
T
- content typeenumeration
- enumeration@NotNull public static <T extends Copyable<T>,C extends java.util.Collection<T>> C copy(@NotNull C target, @NotNull java.util.Enumeration<T> enumeration)
T
- content typeC
- target collection typetarget
- target collection where the copies are storedenumeration
- enumeration@NotNull public static java.lang.String join(@NotNull java.lang.String glue, @NotNull java.lang.String... strings)
glue
- string to use as separatorstrings
- strings to join@NotNull public static java.lang.String join(char glue, @NotNull java.lang.String... strings)
glue
- character to use as separatorstrings
- strings to join@NotNull public static java.lang.String join(@NotNull java.lang.String glue, @NotNull java.lang.Iterable<java.lang.String> strings)
glue
- string to use as separatorstrings
- strings to join@NotNull public static java.lang.String join(char glue, @NotNull java.lang.Iterable<java.lang.String> strings)
glue
- character to use as separatorstrings
- strings to join@NotNull public static java.lang.String join(char glue, @NotNull java.util.Iterator<java.lang.String> strings)
glue
- scharacter to use as separatorstrings
- strings to join@NotNull public static java.lang.String join(@NotNull java.lang.String glue, @NotNull java.util.Iterator<java.lang.String> strings)
glue
- string to use as separatorstrings
- strings to join@NotNull public static java.lang.String join(@NotNull java.lang.String glue, @NotNull java.util.Enumeration<java.lang.String> strings)
glue
- string to use as separatorstrings
- strings to join@NotNull public static <T,S> java.util.Iterator<T> view(@NotNull java.util.Iterator<S> sourceIterator, @NotNull java.util.function.Function<? super S,? extends T> mapper)
map(java.util.Iterator, Function)
this
will work transparently on the fly without creating an intermediate list.T
- target typeS
- source typesourceIterator
- source iteratormapper
- mapper function which converts the source to the target type@NotNull public static <T,S> java.lang.Iterable<T> view(@NotNull java.lang.Iterable<S> sourceIterable, @NotNull java.util.function.Function<? super S,? extends T> mapper)
map(java.lang.Iterable, Function)
this
will work transparently on the fly.T
- target typeS
- source typesourceIterable
- source iterablemapper
- mapper function which converts the source to the target type@NotNull public static <S> java.util.PrimitiveIterator.OfDouble doubleView(@NotNull java.util.Iterator<S> sourceIterator, @NotNull java.util.function.ToDoubleFunction<? super S> doubleMapper)
S
- source element typesourceIterator
- source iteratordoubleMapper
- mapper which maps the elements of the source iterator to double
@NotNull public static <S> PrimitiveDoubleIterable doubleView(@NotNull java.lang.Iterable<S> sourceIterable, @NotNull java.util.function.ToDoubleFunction<? super S> doubleMapper)
double
values.
Because for-each loops will silently introduce boxing/unboxing it is recommended to
iterate over the returned double iterable with its looping functions:
PrimitiveDoubleIterable.forEachDouble(DoubleConsumer)
or
PrimitiveDoubleIterable.forEachDoubleFragile(FragileDoubleConsumer)
(if code throws
checked exceptions).
S
- source element typesourceIterable
- source iterabledoubleMapper
- mapper from the incoming elements to double@NotNull public static <S> PrimitiveFloatIterator floatView(@NotNull java.util.Iterator<S> sourceIterator, @NotNull ToFloatFunction<? super S> floatMapper)
S
- source element typesourceIterator
- source iteratorfloatMapper
- mapper which maps the elements of the source iterator to float
@NotNull public static <S> PrimitiveFloatIterable floatView(@NotNull java.lang.Iterable<S> sourceIterable, @NotNull ToFloatFunction<? super S> floatMapper)
float
values.
Because for-each loops will silently introduce boxing/unboxing it is recommended to
iterate over the returned float iterable with its looping functions:
PrimitiveFloatIterable.forEachFloat(FloatConsumer)
or
PrimitiveFloatIterable.forEachFloatFragile(FragileFloatConsumer)
(if code throws
checked exceptions).
S
- source element typesourceIterable
- source iterablefloatMapper
- mapper from the incoming elements to float@NotNull public static <S> java.util.PrimitiveIterator.OfLong longView(@NotNull java.util.Iterator<S> sourceIterator, @NotNull java.util.function.ToLongFunction<? super S> longMapper)
S
- source element typesourceIterator
- source iteratorlongMapper
- mapper which maps the elements of the source iterator to long
@NotNull public static <S> PrimitiveLongIterable longView(@NotNull java.lang.Iterable<S> sourceIterable, @NotNull java.util.function.ToLongFunction<? super S> longMapper)
long
values.
Because for-each loops will silently introduce boxing/unboxing it is recommended to
iterate over the returned long iterable with its looping functions:
PrimitiveLongIterable.forEachLong(LongConsumer)
or
PrimitiveLongIterable.forEachLongFragile(FragileLongConsumer)
(if code throws
checked exceptions).
S
- source element typesourceIterable
- source iterablelongMapper
- mapper from the incoming elements to long@NotNull public static <S> java.util.PrimitiveIterator.OfInt intView(@NotNull java.util.Iterator<S> sourceIterator, @NotNull java.util.function.ToIntFunction<? super S> intMapper)
S
- source element typesourceIterator
- source iteratorintMapper
- mapper which maps the elements of the source iterator to int
@NotNull public static <S> PrimitiveIntIterable intView(@NotNull java.lang.Iterable<S> sourceIterable, @NotNull java.util.function.ToIntFunction<? super S> intMapper)
int
values.
Because for-each loops will silently introduce boxing/unboxing it is recommended to
iterate over the returned int iterable with its looping functions:
PrimitiveIntIterable.forEachInt(IntConsumer)
or
PrimitiveIntIterable.forEachIntFragile(FragileIntConsumer)
(if code throws
checked exceptions).
S
- source element typesourceIterable
- source iterableintMapper
- mapper from the incoming elements to int@NotNull public static <S> PrimitiveShortIterator shortView(@NotNull java.util.Iterator<S> sourceIterator, @NotNull ToShortFunction<? super S> shortMapper)
S
- source element typesourceIterator
- source iteratorshortMapper
- mapper which maps the elements of the source iterator to short
@NotNull public static <S> PrimitiveShortIterable shortView(@NotNull java.lang.Iterable<S> sourceIterable, @NotNull ToShortFunction<? super S> shortMapper)
short
values.
Because for-each loops will silently introduce boxing/unboxing it is recommended to
iterate over the returned short iterable with its looping functions:
PrimitiveShortIterable.forEachShort(ShortConsumer)
or
PrimitiveShortIterable.forEachShortFragile(FragileShortConsumer)
(if code throws
checked exceptions).
S
- source element typesourceIterable
- source iterableshortMapper
- mapper from the incoming elements to short@NotNull public static <S> PrimitiveCharIterator charView(@NotNull java.util.Iterator<S> sourceIterator, @NotNull ToCharFunction<? super S> charMapper)
S
- source element typesourceIterator
- source iteratorcharMapper
- mapper which maps the elements of the source iterator to char
@NotNull public static <S> PrimitiveCharIterable charView(@NotNull java.lang.Iterable<S> sourceIterable, @NotNull ToCharFunction<? super S> charMapper)
char
values.
Because for-each loops will silently introduce boxing/unboxing it is recommended to
iterate over the returned char iterable with its looping functions:
PrimitiveCharIterable.forEachChar(CharConsumer)
or
PrimitiveCharIterable.forEachCharFragile(FragileCharConsumer)
(if code throws
checked exceptions).
S
- source element typesourceIterable
- source iterablecharMapper
- mapper from the incoming elements to char@NotNull public static <S> PrimitiveByteIterator byteView(@NotNull java.util.Iterator<S> sourceIterator, @NotNull ToByteFunction<? super S> byteMapper)
S
- source element typesourceIterator
- source iteratorbyteMapper
- mapper which maps the elements of the source iterator to byte
@NotNull public static <S> PrimitiveByteIterable byteView(@NotNull java.lang.Iterable<S> sourceIterable, @NotNull ToByteFunction<? super S> byteMapper)
byte
values.
Because for-each loops will silently introduce boxing/unboxing it is recommended to
iterate over the returned byte iterable with its looping functions:
PrimitiveByteIterable.forEachByte(ByteConsumer)
or
PrimitiveByteIterable.forEachByteFragile(FragileByteConsumer)
(if code throws
checked exceptions).
S
- source element typesourceIterable
- source iterablebyteMapper
- mapper from the incoming elements to byte@NotNull public static <S> PrimitiveBooleanIterator booleanView(@NotNull java.util.Iterator<S> sourceIterator, @NotNull java.util.function.Predicate<? super S> booleanMapper)
S
- source element typesourceIterator
- source iteratorbooleanMapper
- mapper which maps the elements of the source iterator to boolean
@NotNull public static <S> PrimitiveBooleanIterable booleanView(@NotNull java.lang.Iterable<S> sourceIterable, @NotNull java.util.function.Predicate<? super S> booleanMapper)
boolean
values.
Because for-each loops will silently introduce boxing/unboxing it is recommended to
iterate over the returned boolean iterable with its looping functions:
PrimitiveBooleanIterable.forEachBool(BooleanConsumer)
or
PrimitiveBooleanIterable.forEachBoolFragile(FragileBooleanConsumer)
(if code throws
checked exceptions).
S
- source element typesourceIterable
- source iterablebooleanMapper
- mapper from the incoming elements to boolean@NotNull public static <T,S> Indexable<T> view(@NotNull Indexable<S> sourceIndexable, @NotNull java.util.function.Function<? super S,T> mapper)
map(java.lang.Iterable, Function)
this
will work transparently on the fly.T
- target typeS
- source typesourceIndexable
- source indesxablemapper
- mapper function which converts the source to the target typeIndexable.view(Function)
@NotNull public static <T,S> java.util.ListIterator<T> view(@NotNull java.util.ListIterator<S> sourceIterator, @NotNull java.util.function.Function<? super S,T> mapper)
map(java.util.Iterator, Function)
this
will work transparently on the fly without creating an intermediate list.T
- target typeS
- source typesourceIterator
- source iteratormapper
- mapper function which converts the source to the target type@NotNull @SafeVarargs public static <T,S> java.lang.Iterable<T> view(@NotNull java.util.function.Function<? super S,T> mapper, @NotNull S... array)
Changes to the array during the use of the resulting iterable will lead to undefined behavior.
T
- target typeS
- source typemapper
- mapper function which converts the source to the target typearray
- array to be view differentlyIndexable.viewArray(Object[])
@NotNull public static <T,S> java.util.Collection<T> viewCollection(@NotNull java.util.Collection<S> collection, @NotNull java.util.function.Function<? super S,T> mapper)
map(Collection, Function)
this does not copy the collection, instead it applies the mapper on each access. So
in general it is most useful when elements are rarely read, eg for iterating over them.
Possible restrictions on the source collection (eg a set may contain elements only once,
or it may be ordered) are no longer guaranteed by the returned collection. Use
map(Collection, Iterable, Function)
where you can provide the required
target collection in cases where these restrictions are required.
T
- target typeS
- source typecollection
- original collectionmapper
- mapper which creates the element type of the result collection@NotNull public static <T,S> java.util.List<T> viewList(@NotNull java.util.List<S> list, @NotNull java.util.function.Function<? super S,T> mapper)
map(Collection, Function)
this does not copy the list, instead it applies the mapper on each access. So
in general it is most useful when elements are rarely read, eg for iterating over them.T
- target typeS
- source typelist
- original listmapper
- mapper which creates the element type of the result collectionpublic static <T> java.util.Iterator<T> unmodifiable(@NotNull java.util.Iterator<T> iterator)
The Iterator
interface exports a method allowing to delete elements.
The wrapper returned from this method will throw an
UnsupportedOperationException
for this method.
T
- element type of iteratoriterator
- iterator to wrappublic static <T> java.util.ListIterator<T> unmodifiable(@NotNull java.util.ListIterator<T> iterator)
The ListIterator
interface exports methods allowing to modify the
underlying list. The wrapper returned from this method will throw an
UnsupportedOperationException
for these methods.
T
- element type of iteratoriterator
- iterator to wrappublic static <T> Factory<T> makeFactory(java.lang.Class<T> type)
The factory will only create new objects if there is an argumentless public default constructor for the given type. This method is thought for highly dynamic situations. In most cases it is recommended to create a factory as an anonymous class:
// this is BAD style Factory<XY> factory1 = Types.makeFactory(XY.class); // this is GOOD style Factory<XY> factory2 = new Factory<XY>() { public XY create() { return new XY(); } };
T
- typetype
- type infopublic static <T> ArrayFactory<T> makeArrayFactory(java.lang.Class<T> type)
This method is thought for highly dynamic situations. In most cases it is recommended to create a factory as an anonymous class:
// this is BAD style ArrayFactory<XY> factory1 = Types.makeArrayFactory(XY.class); // this is GOOD style ArrayFactory<XY> factory2 = new ArrayFactory<XY>() { public XY[] create(int length) { return new XY[length]; } };
T
- typetype
- type info@NotNull public static <T,S> FragileTypeConverter<T,S> asTypeConverter(@NotNull FragileFunction1<T,? extends java.lang.Exception,S> function)
T
- target typeS
- source typefunction
- function to use@NotNull public static <T> java.util.Iterator<T> emptyIterator()
T
- iteration type (ignored as no iteration is done)@NotNull public static <T> java.util.ListIterator<T> emptyListIterator()
T
- iteration element type (ignored as no iteration is done)@NotNull public static <T> java.util.Enumeration<T> emptyEnumeration()
T
- enumeration type (ignored as no iteration is done)@NotNull public static <T> java.lang.Iterable<T> emptyIterable()
T
- iterable type (ignored as no iteration is done)@NotNull public static <T extends Copyable<T>> java.util.function.Function<T,T> getCopier(@NotNull java.lang.Class<T> elemClass)
T
- class type, has to implement Copyable
elemClass
- element class@NotNull public static <T> java.util.ArrayList<T> clone(@NotNull java.util.Collection<T> sourceCollection, @NotNull java.util.function.Function<T,T> cloner)
T
- list typesourceCollection
- source collectioncloner
- cloner which clones one list element@NotNull public static <T> java.util.ArrayList<T> clone(@NotNull Countable<T> sourceCountable, @NotNull java.util.function.Function<T,T> cloner)
T
- list typesourceCountable
- source countablecloner
- cloner which clones one list element@SafeVarargs @NotNull public static <T> java.lang.Iterable<T> concat(@NotNull java.lang.Iterable<? extends T>... iterables)
T
- iteration element typeiterables
- iterables to concatenate@NotNull public static <T> java.lang.Iterable<T> concatIterables(@NotNull java.lang.Iterable<? extends java.lang.Iterable<? extends T>> iterables)
T
- iteration element typeiterables
- iterables to concatenate@SafeVarargs @NotNull public static <T> java.util.Iterator<T> concat(@NotNull java.util.Iterator<? extends T>... iterators)
T
- iteration element typeiterators
- iterators to concatenate@NotNull public static <T> java.util.Iterator<T> concatIterators(@NotNull java.lang.Iterable<? extends java.util.Iterator<? extends T>> iterators)
T
- iteration element typeiterators
- iterators to concatenate@NotNull public static <T,D extends T> T notNull(@Nullable T item, @NotNull D defaultValue)
null
.
Use a default value if necessary.T
- item typeD
- default value typeitem
- item which may be null
defaultValue
- default value substituted if item is null
item
if it is not null
,
defaultValue
otherwise@NotNull public static java.lang.String notNull(@Nullable java.lang.String str)
null
.
Use the empty string if necessary.str
- string which might be null
null
, the empty string otherwise@NotNull public static <T> T notNullOr(@Nullable T item, @NotNull java.util.function.Supplier<? extends T> provider)
null
,
but postpone the fallback creation.
This is similar to notNull(Object, Object)
,
but is creating the second defaultObject
parameter
only when required. This is preferable if creating the object
is an expensive process.T
- type of nullable valueitem
- item which is tested for being null
provider
- supplier asked to provide a fallback when item
is null
,
required to return non-null object!item
if it is not null
,
or a fallback created by provider
java.lang.IllegalArgumentException
- if provider creates null
notNullOrN(Object, Supplier)
@Nullable public static <T> T notNullOrN(@Nullable T item, @NotNull java.util.function.Supplier<? extends T> provider)
null
.
This is useful in cases where the fallback creation is expensive.
In difference to notNullOr(Object, Supplier)
this accepts
the fallback provider to return null
. Thus, it is necessary
to check the result of this method for being null
.
T
- type of nullable valueitem
- item which is tested for being