Klasse ObjectIterables

java.lang.Object
speiger.src.collections.objects.utils.ObjectIterables

public class ObjectIterables extends Object
A Helper class for Iterables
  • Konstruktordetails

    • ObjectIterables

      public ObjectIterables()
  • Methodendetails

    • map

      public static <T, E> ObjectIterable<E> map(Iterable<? extends T> iterable, UnaryOperator<T,E> mapper)
      A Helper function that maps a Java-Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      E - The return type.
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • map

      public static <T, E> ObjectIterable<E> map(ObjectIterable<T> iterable, UnaryOperator<T,E> mapper)
      A Helper function that maps a Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      E - The return type.
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToBoolean

      public static <T> BooleanIterable mapToBoolean(Iterable<? extends T> iterable, Predicate<T> mapper)
      A Helper function that maps a Java-Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToBoolean

      public static <T> BooleanIterable mapToBoolean(ObjectIterable<T> iterable, Predicate<T> mapper)
      A Helper function that maps a Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToByte

      public static <T> ByteIterable mapToByte(Iterable<? extends T> iterable, ToByteFunction<T> mapper)
      A Helper function that maps a Java-Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToByte

      public static <T> ByteIterable mapToByte(ObjectIterable<T> iterable, ToByteFunction<T> mapper)
      A Helper function that maps a Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToShort

      public static <T> ShortIterable mapToShort(Iterable<? extends T> iterable, ToShortFunction<T> mapper)
      A Helper function that maps a Java-Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToShort

      public static <T> ShortIterable mapToShort(ObjectIterable<T> iterable, ToShortFunction<T> mapper)
      A Helper function that maps a Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToInt

      public static <T> IntIterable mapToInt(Iterable<? extends T> iterable, ToIntFunction<T> mapper)
      A Helper function that maps a Java-Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToInt

      public static <T> IntIterable mapToInt(ObjectIterable<T> iterable, ToIntFunction<T> mapper)
      A Helper function that maps a Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToLong

      public static <T> LongIterable mapToLong(Iterable<? extends T> iterable, ToLongFunction<T> mapper)
      A Helper function that maps a Java-Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToLong

      public static <T> LongIterable mapToLong(ObjectIterable<T> iterable, ToLongFunction<T> mapper)
      A Helper function that maps a Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToFloat

      public static <T> FloatIterable mapToFloat(Iterable<? extends T> iterable, ToFloatFunction<T> mapper)
      A Helper function that maps a Java-Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToFloat

      public static <T> FloatIterable mapToFloat(ObjectIterable<T> iterable, ToFloatFunction<T> mapper)
      A Helper function that maps a Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToDouble

      public static <T> DoubleIterable mapToDouble(Iterable<? extends T> iterable, ToDoubleFunction<T> mapper)
      A Helper function that maps a Java-Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • mapToDouble

      public static <T> DoubleIterable mapToDouble(ObjectIterable<T> iterable, ToDoubleFunction<T> mapper)
      A Helper function that maps a Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - the iterable that should be mapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is mapped to a new result
    • flatMap

      public static <T, E, V extends Iterable<E>> ObjectIterable<E> flatMap(Iterable<? extends T> iterable, UnaryOperator<T,V> mapper)
      A Helper function that flatMaps a Java-Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      E - The return type.
      V - The return type supplier.
      Parameter:
      iterable - the iterable that should be flatMapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is flatMapped to a new result
    • flatMap

      public static <T, E, V extends Iterable<E>> ObjectIterable<E> flatMap(ObjectIterable<T> iterable, UnaryOperator<T,V> mapper)
      A Helper function that flatMaps a Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      E - The return type.
      V - The return type supplier.
      Parameter:
      iterable - the iterable that should be flatMapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is flatMapped to a new result
    • arrayFlatMap

      public static <T, E> ObjectIterable<E> arrayFlatMap(Iterable<? extends T> iterable, UnaryOperator<T,E[]> mapper)
      A Helper function that flatMaps a Java-Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      E - The return type.
      Parameter:
      iterable - the iterable that should be flatMapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is flatMapped to a new result
    • arrayFlatMap

      public static <T, E> ObjectIterable<E> arrayFlatMap(ObjectIterable<T> iterable, UnaryOperator<T,E[]> mapper)
      A Helper function that flatMaps a Iterable into a new Type.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      E - The return type.
      Parameter:
      iterable - the iterable that should be flatMapped
      mapper - the function that decides what the result turns into.
      Gibt zurück:
      a iterable that is flatMapped to a new result
    • filter

      public static <T> ObjectIterable<T> filter(Iterable<? extends T> iterable, Predicate<T> filter)
      A Helper function that filters out all desired elements from a Java-Iterable
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be filtered.
      filter - the filter that decides that should be let through
      Gibt zurück:
      a filtered iterable
    • filter

      public static <T> ObjectIterable<T> filter(ObjectIterable<T> iterable, Predicate<T> filter)
      A Helper function that filters out all desired elements
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be filtered.
      filter - the filter that decides that should be let through
      Gibt zurück:
      a filtered iterable
    • distinct

      public static <T> ObjectIterable<T> distinct(ObjectIterable<T> iterable)
      A Helper function that filters out all duplicated elements.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be distinct
      Gibt zurück:
      a distinct iterable
    • distinct

      public static <T> ObjectIterable<T> distinct(Iterable<? extends T> iterable)
      A Helper function that filters out all duplicated elements from a Java Iterable.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be distinct
      Gibt zurück:
      a distinct iterable
    • repeat

      public static <T> ObjectIterable<T> repeat(ObjectIterable<T> iterable, int repeats)
      A Helper function that repeats the Iterable a specific amount of times
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be repeated
      repeats - the amount of times the iterable should be repeated
      Gibt zurück:
      a repeating iterable
    • repeat

      public static <T> ObjectIterable<T> repeat(Iterable<? extends T> iterable, int repeats)
      A Helper function that repeats the Iterable a specific amount of times from a Java Iterable
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be repeated
      repeats - the amount of times the iterable should be repeated
      Gibt zurück:
      a repeating iterable
    • limit

      public static <T> ObjectIterable<T> limit(ObjectIterable<T> iterable, long limit)
      A Helper function that hard limits the Iterable to a specific size
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be limited
      limit - the amount of elements it should be limited to
      Gibt zurück:
      a limited iterable
    • limit

      public static <T> ObjectIterable<T> limit(Iterable<? extends T> iterable, long limit)
      A Helper function that hard limits the Iterable to a specific size from a Java Iterable
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be limited
      limit - the amount of elements it should be limited to
      Gibt zurück:
      a limited iterable
    • sorted

      public static <T> ObjectIterable<T> sorted(ObjectIterable<T> iterable, Comparator<T> sorter)
      A Helper function that sorts the Iterable. This operation is heavily hurting performance because it rebuilds the entire iterator and then sorts it.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be sorted
      sorter - that sorts the iterable. Can be null.
      Gibt zurück:
      a sorted iterable.
    • sorted

      public static <T> ObjectIterable<T> sorted(Iterable<? extends T> iterable, Comparator<T> sorter)
      A Helper function that sorts the Iterable from a Java Iterable This operation is heavily hurting performance because it rebuilds the entire iterator and then sorts it.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be sorted
      sorter - that sorts the iterable. Can be null.
      Gibt zurück:
      a sorted iterable.
    • peek

      public static <T> ObjectIterable<T> peek(ObjectIterable<T> iterable, Consumer<T> action)
      A Helper function that allows to preview the result of a Iterable.
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be peeked at
      action - callback that receives the value before the iterable returns it
      Gibt zurück:
      a peeked iterable
    • peek

      public static <T> ObjectIterable<T> peek(Iterable<? extends T> iterable, Consumer<T> action)
      A Helper function that allows to preview the result of a Iterable from a Java Iterable
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be peeked at
      action - callback that receives the value before the iterable returns it
      Gibt zurück:
      a peeked iterable
    • wrap

      public static <T> ObjectIterable<T> wrap(Iterable<? extends T> iterable)
      A Wrapper function that wraps a Java-Iterable into a Type Specific Iterable
      Typparameter:
      T - the keyType of elements maintained by this Collection
      Parameter:
      iterable - that should be wrapped
      Gibt zurück:
      a type specific iterable