Interface ArrayUtils


public interface ArrayUtils
  • Method Details

    • ofSet

      @SafeVarargs static <T> Set<T> ofSet(T... values)
    • contains

      static <A,​ B> boolean contains(A[] a, B[] b)
    • getCommon

      @SafeVarargs static <O,​ T> Set<T> getCommon(Function<O,​T> function, Function<T,​String> toID, O... collection)
    • getCommon

      static <O,​ T> Set<T> getCommon(Function<O,​T> function, Function<T,​String> toID, Iterable<O> collection)
    • build

      static <E,​ I,​ T extends Collection<I>> T build(T array, BiConsumer<T,​E> consumer, Iterable<E> collection)
    • convert

      static <A,​ E,​ I,​ T extends Collection<E>> T convert(Collector<E,​I,​T> collector, Function<A,​E> consumer, Iterable<A> collection)
      Converts the array into another array
      Type Parameters:
      A - The original array element type
      E - The new array element type
      I - The supplier
      T - The supplier
      Parameters:
      collector - The return collection type
      consumer - Convert element from the original to the new
      collection - The original array
      Returns:
      The new array
    • convert

      @SafeVarargs static <E,​ T> T[] convert(Class<T> clazz, Function<E,​T> function, E... array)
      Converts the array into another array
      Type Parameters:
      E - The original array element
      T - The new array element
      Parameters:
      clazz - The new array type
      function - convert the original element to the new
      array - the original array
      Returns:
      The new array
    • convert

      static <E,​ I> List<I> convert(Function<E,​I> function, Iterable<E> collection)
      Converts the array into another array
      Type Parameters:
      E - The original collection element
      I - The new collection element type
      Parameters:
      function - how to convert the element
      collection - the original collection
      Returns:
      The new list
    • convert

      static <E,​ I,​ T extends Collection<I>> T convert(T array, Function<E,​I> function, Iterable<E> collection)
      Converts the array into another array
      Type Parameters:
      E - original array element
      I - new array element type
      T - collection type
      Parameters:
      array - array to add to
      function - convert element to the other
      collection - the original array
      Returns:
      the provided new collection
    • toMappedValues

      static <K,​ V> Map<K,​V> toMappedValues(Function<V,​K> toKey, Collection<V> keys)
    • toMappedKeys

      static <K,​ V> Map<K,​V> toMappedKeys(Function<K,​V> toKey, Collection<K> keys)
    • toString

      @Deprecated static <T> String toString(String split, Function<T,​String> toString, Collection<T> collection)
      Deprecated.
    • getBest

      @SafeVarargs static <T> Optional<T> getBest(Function<T,​Integer> function, BiPredicate<Integer,​Integer> compare, T... array)
      Gets the "best" element from the provided array
      Type Parameters:
      T - element type
      Parameters:
      function - convert element to value
      compare - compare two values
      array - original array
      Returns:
      the "best" element - optional if no best can be found
    • getBest

      static <T,​ N extends Number> Optional<T> getBest(Function<T,​N> function, BiPredicate<N,​N> compare, Iterable<T> collection)
      Gets the "best" element from the provided array
      Type Parameters:
      T - element type
      Parameters:
      function - convert element to value
      compare - compare two values
      collection - original array
      Returns:
      the "best" element - optional if no best can be found
    • getBests

      @SafeVarargs static <T,​ N extends Number> Set<T> getBests(Function<T,​N> function, BiPredicate<N,​N> compare, BiPredicate<N,​N> equal, T... array)
      Gets the "best" values from the collection
      Type Parameters:
      T - element type
      N - The value to compare
      Parameters:
      function - convert element to value
      compare - compare two values (current best > comparison)
      equal - checks the two value are equal
      array - the original array
      Returns:
      the best elements
    • getBests

      static <T,​ N extends Number> Set<T> getBests(Function<T,​N> function, BiPredicate<N,​N> compare, BiPredicate<N,​N> equal, Iterable<T> collection)
      Gets the "best" values from the collection
      Type Parameters:
      T - element type
      N - The value to compare
      Parameters:
      function - convert element to value
      compare - compare two values (current best > comparison)
      equal - checks the two value are equal
      collection - the original array
      Returns:
      the best elements
    • trim

      static String[] trim(int amount, String... array)
    • filter

      static String[] filter(int min, int max, String... array)
    • filterOut

      static String[] filterOut(int start, int end, String... array)
    • buildArray

      @SafeVarargs static <X,​ T> T[] buildArray(Class<T> clazz, Function<X,​T[]> function, X... array)
    • buildArray

      static <X,​ T> T[] buildArray(Class<T> clazz, Function<X,​T[]> function, Iterable<X> collection)
    • join

      @SafeVarargs static <T> T[] join(Class<T> clazz, T[]... arrays)
    • join

      static <T> T[] join(Class<T> clazz, T[] array1, T[] array2)
    • splitBy

      static String[] splitBy(String toSplit, int startWith, boolean combineStartWith, Predicate<? super Character> splitBy)