Interface IIterableArrayMapper

All Known Subinterfaces:
IIterableMapper
All Known Implementing Classes:
IterableMapper

public interface IIterableArrayMapper
Author:
Silvan Wyss
  • Method Summary

    Modifier and Type
    Method
    Description
    <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.
  • Method Details

    • toIntArray

      <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.
      Type Parameters:
      E - the type of the elements of the given iterable
      Parameters:
      iterable - the mapped iterable, is considered to be empty when is null
      n -
      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
      Throws:
      RuntimeException - if the given n is negative or bigger than the size of the given iterable
      RuntimeException - if the given intMapper is null
    • toDoubleArray

      <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.
      Type Parameters:
      E - the type of the elements of the given iterable
      Parameters:
      iterable - the mapped iterable, is considered to be empty when is null
      n -
      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
      Throws:
      RuntimeException - if the given n is negative or bigger than the size of the given iterable
      RuntimeException - if the given doubleMapper is null