Class ArrayUtils


  • public class ArrayUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T[] append​(java.lang.Class<T> elemClass, T[] array, T... values)  
      static boolean contained​(int value, int[] array)  
      static <T> boolean contained​(T value, T[] array)  
      static <T> T firstOf​(T[] ts, int fromIndex, int endIndex, java.util.function.Predicate<? super T> predicate)  
      static <T> T firstOf​(T[] ts, int fromIndex, java.util.function.Predicate<? super T> predicate)  
      static <T> T firstOf​(T[] ts, java.util.function.Predicate<? super T> predicate)  
      static <T> int indexOf​(T[] ts, int fromIndex, int endIndex, java.util.function.Predicate<? super T> predicate)  
      static <T> int indexOf​(T[] ts, int fromIndex, java.util.function.Predicate<? super T> predicate)  
      static <T> int indexOf​(T[] ts, java.util.function.Predicate<? super T> predicate)  
      static <T> int indexOf​(T t, T[] ts)  
      static <T> int indexOf​(T t, T[] ts, int fromIndex)  
      static <T> int indexOf​(T t, T[] ts, int fromIndex, int endIndex)  
      static <T> int lastIndexOf​(T[] ts, int startIndex, int fromIndex, java.util.function.Predicate<? super T> predicate)  
      static <T> int lastIndexOf​(T[] ts, int fromIndex, java.util.function.Predicate<? super T> predicate)  
      static <T> int lastIndexOf​(T[] ts, java.util.function.Predicate<? super T> predicate)  
      static <T> int lastIndexOf​(T t, T[] ts)  
      static <T> int lastIndexOf​(T t, T[] ts, int fromIndex)  
      static <T> int lastIndexOf​(T t, T[] ts, int startIndex, int fromIndex)  
      static <T> T lastOf​(T[] ts, int startIndex, int fromIndex, java.util.function.Predicate<? super T> predicate)  
      static <T> T lastOf​(T[] ts, int fromIndex, java.util.function.Predicate<? super T> predicate)  
      static <T> T lastOf​(T[] ts, java.util.function.Predicate<? super T> predicate)  
      static int[] toArray​(java.util.BitSet bitSet)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArrayUtils

        public ArrayUtils()
    • Method Detail

      • contained

        public static <T> boolean contained​(T value,
                                            T[] array)
      • append

        @SafeVarargs
        public static <T> T[] append​(java.lang.Class<T> elemClass,
                                     T[] array,
                                     T... values)
      • contained

        public static boolean contained​(int value,
                                        int[] array)
      • firstOf

        public static <T> T firstOf​(T[] ts,
                                    java.util.function.Predicate<? super T> predicate)
      • firstOf

        public static <T> T firstOf​(T[] ts,
                                    int fromIndex,
                                    java.util.function.Predicate<? super T> predicate)
      • firstOf

        @Nullable
        public static <T> T firstOf​(T[] ts,
                                    int fromIndex,
                                    int endIndex,
                                    java.util.function.Predicate<? super T> predicate)
      • indexOf

        public static <T> int indexOf​(T t,
                                      T[] ts)
      • indexOf

        public static <T> int indexOf​(T t,
                                      T[] ts,
                                      int fromIndex)
      • indexOf

        public static <T> int indexOf​(T t,
                                      T[] ts,
                                      int fromIndex,
                                      int endIndex)
      • indexOf

        public static <T> int indexOf​(T[] ts,
                                      java.util.function.Predicate<? super T> predicate)
      • indexOf

        public static <T> int indexOf​(T[] ts,
                                      int fromIndex,
                                      java.util.function.Predicate<? super T> predicate)
      • indexOf

        public static <T> int indexOf​(T[] ts,
                                      int fromIndex,
                                      int endIndex,
                                      java.util.function.Predicate<? super T> predicate)
        Type Parameters:
        T - type of array
        Parameters:
        ts - array
        fromIndex - the start index from which search in the array. There is no restriction on the value of fromIndex. If it is less than 0, it has the same effect as if it were 0. If it is greater or equal to length of the array, -1 is returned.
        endIndex - the end index of the array, ie. treat as if array.length was endIndex. There is no restriction on the value of endIndex. If it is greater than or equal to the length of this array, it has the same effect as if it were equal to length of this array. If it is negative, it has the same effect as if it were 0: -1 is returned.
        predicate - condition for matching the search
        Returns:
        the index of the next occurrence of a match in the array which is greater than or equal to fromIndex, or -1 if match does not occur after that point.
      • lastOf

        public static <T> T lastOf​(T[] ts,
                                   java.util.function.Predicate<? super T> predicate)
      • lastOf

        public static <T> T lastOf​(T[] ts,
                                   int fromIndex,
                                   java.util.function.Predicate<? super T> predicate)
      • lastOf

        public static <T> T lastOf​(T[] ts,
                                   int startIndex,
                                   int fromIndex,
                                   java.util.function.Predicate<? super T> predicate)
      • lastIndexOf

        public static <T> int lastIndexOf​(T t,
                                          T[] ts)
      • lastIndexOf

        public static <T> int lastIndexOf​(T t,
                                          T[] ts,
                                          int fromIndex)
      • lastIndexOf

        public static <T> int lastIndexOf​(T t,
                                          T[] ts,
                                          int startIndex,
                                          int fromIndex)
      • lastIndexOf

        public static <T> int lastIndexOf​(T[] ts,
                                          java.util.function.Predicate<? super T> predicate)
      • lastIndexOf

        public static <T> int lastIndexOf​(T[] ts,
                                          int fromIndex,
                                          java.util.function.Predicate<? super T> predicate)
      • lastIndexOf

        public static <T> int lastIndexOf​(T[] ts,
                                          int startIndex,
                                          int fromIndex,
                                          java.util.function.Predicate<? super T> predicate)
        Type Parameters:
        T - type of array
        Parameters:
        ts - array
        startIndex - the minimum index to search in the array. There is no restriction on the value of startIndex. If it is less than 0, it has the same effect as if it were 0. If it is greater or equal to length of the array, -1 is returned.
        fromIndex - the index to start the search from. There is no restriction on the value of fromIndex. If it is greater than or equal to the length of this array, it has the same effect as if it were equal to one less than the length of this array: this entire array may be searched. If it is negative, it has the same effect as if it were -1: -1 is returned.
        predicate - condition for matching the search
        Returns:
        the index of the last occurrence of a match in the array which is less than or equal to fromIndex, or -1 if match does not occur before that point.
      • toArray

        public static int[] toArray​(@NotNull
                                    java.util.BitSet bitSet)