Class IterableMapper
java.lang.Object
ch.nolix.base.commontype.iterablemapper.IterableMapper
- All Implemented Interfaces:
IIterableArrayMapper, IIterableMapper
- Author:
- Silvan Wyss
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<E> double[]toDoubleArray(Iterable<E> iterable, int n, ToDoubleFunction<E> doubleMapper) The time complexity of this method is O(n) if the given iterable contains n elements.<E> int[]toIntArray(Iterable<E> iterable, int n, ToIntFunction<E> intMapper) The time complexity of this method is O(n) if the given iterable contains n elements.
-
Constructor Details
-
IterableMapper
public IterableMapper()
-
-
Method Details
-
toIntArray
The time complexity of this method is O(n) if the given iterable contains n elements.- Specified by:
toIntArrayin interfaceIIterableArrayMapper- Type Parameters:
E- the type of the elements of the given iterable- Parameters:
iterable- the mapped iterable, is considered to be empty when is nulln-intMapper-- Returns:
- a new array with the first n ints the given intMapper maps from the elements of the given iterable, mapping null elements to 0
-
toDoubleArray
The time complexity of this method is O(n) if the given iterable contains n elements.- Specified by:
toDoubleArrayin interfaceIIterableArrayMapper- Type Parameters:
E- the type of the elements of the given iterable- Parameters:
iterable- the mapped iterable, is considered to be empty when is nulln-doubleMapper-- Returns:
- a new array with the first n doubles the given doubleMapper maps from the elements of the given iterable, mapping null elements to 0.0
-