Class Utils.ArrayUtils

java.lang.Object
net.risingworld.api.utils.Utils.ArrayUtils
Enclosing class:
Utils

public abstract static class Utils.ArrayUtils extends Object
Contains various array-related helper methods.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    append(byte[] array, byte value)
     
    static int[]
    append(int[] array, int value)
     
    static String[]
    append(String[] array, String value)
     
    static boolean
    contains(byte[] array, byte value)
    Checks if an array contains the specified byte value.
    static boolean
    contains(char[] array, char value)
    Checks if an array contains the specified char value.
    static boolean
    contains(double[] array, double value)
    Checks if an array contains the specified double value.
    static boolean
    contains(float[] array, float value)
    Checks if an array contains the specified float value.
    static boolean
    contains(int[] array, int value)
    Checks if an array contains the specified int value.
    static boolean
    contains(long[] array, long value)
    Checks if an array contains the specified long value.
    static boolean
    contains(short[] array, short value)
    Checks if an array contains the specified short value.
    static <T> boolean
    contains(T[] array, T value)
    Checks if an array contains the specified value.
    static int
    indexOf(byte[] array, byte value)
    Gets the index of the specified byte value in the provided array.
    static int
    indexOf(char[] array, char value)
    Gets the index of the specified char value in the provided array.
    static int
    indexOf(double[] array, double value)
    Gets the index of the specified double value in the provided array.
    static int
    indexOf(float[] array, float value)
    Gets the index of the specified float value in the provided array.
    static int
    indexOf(int[] array, int value)
    Gets the index of the specified int value in the provided array.
    static int
    indexOf(long[] array, long value)
    Gets the index of the specified long value in the provided array.
    static int
    indexOf(short[] array, short value)
    Gets the index of the specified short value in the provided array.
    static <T> int
    indexOf(T[] array, T value)
    Gets the index of the specified value in the provided array.
    static int[]
    removeEntries(int[] array, int value)
     
    static String[]
    removeEntries(String[] array, String value)
     
    static byte[]
    resize(byte[] array, int newLength)
     
    static int[]
    resize(int[] array, int newLength)
     
    static String[]
    resize(String[] array, int newLength)
     
    static <T> void
    shiftRight(T[] array, int start, int end)
     
    static void
    shuffle(int[] array, int from, int to)
     

    Methods inherited from class java.lang.Object

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

    • ArrayUtils

      public ArrayUtils()
  • Method Details

    • contains

      public static <T> boolean contains(T[] array, T value)
      Checks if an array contains the specified value.
      Type Parameters:
      T - type of array elements.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      true if the array contains the value, false if not.
    • contains

      public static boolean contains(byte[] array, byte value)
      Checks if an array contains the specified byte value.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      true if the array contains the value, false if not.
    • contains

      public static boolean contains(char[] array, char value)
      Checks if an array contains the specified char value.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      true if the array contains the value, false if not.
    • contains

      public static boolean contains(short[] array, short value)
      Checks if an array contains the specified short value.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      true if the array contains the value, false if not.
    • contains

      public static boolean contains(int[] array, int value)
      Checks if an array contains the specified int value.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      true if the array contains the value, false if not.
    • contains

      public static boolean contains(long[] array, long value)
      Checks if an array contains the specified long value.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      true if the array contains the value, false if not.
    • contains

      public static boolean contains(float[] array, float value)
      Checks if an array contains the specified float value.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      true if the array contains the value, false if not.
    • contains

      public static boolean contains(double[] array, double value)
      Checks if an array contains the specified double value.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      true if the array contains the value, false if not.
    • indexOf

      public static int indexOf(byte[] array, byte value)
      Gets the index of the specified byte value in the provided array.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      the index of the value in the array, or -1 if it could not be found.
    • indexOf

      public static int indexOf(char[] array, char value)
      Gets the index of the specified char value in the provided array.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      the index of the value in the array, or -1 if it could not be found.
    • indexOf

      public static int indexOf(short[] array, short value)
      Gets the index of the specified short value in the provided array.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      the index of the value in the array, or -1 if it could not be found.
    • indexOf

      public static int indexOf(int[] array, int value)
      Gets the index of the specified int value in the provided array.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      the index of the value in the array, or -1 if it could not be found.
    • indexOf

      public static int indexOf(float[] array, float value)
      Gets the index of the specified float value in the provided array.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      the index of the value in the array, or -1 if it could not be found.
    • indexOf

      public static int indexOf(long[] array, long value)
      Gets the index of the specified long value in the provided array.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      the index of the value in the array, or -1 if it could not be found.
    • indexOf

      public static int indexOf(double[] array, double value)
      Gets the index of the specified double value in the provided array.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      the index of the value in the array, or -1 if it could not be found.
    • indexOf

      public static <T> int indexOf(T[] array, T value)
      Gets the index of the specified value in the provided array.
      Type Parameters:
      T - type of array elements.
      Parameters:
      array - the array.
      value - the value you're looking for.
      Returns:
      the index of the value in the array, or -1 if it could not be found.
    • shiftRight

      public static <T> void shiftRight(T[] array, int start, int end)
    • append

      public static String[] append(String[] array, String value)
    • append

      public static int[] append(int[] array, int value)
    • append

      public static byte[] append(byte[] array, byte value)
    • resize

      public static String[] resize(String[] array, int newLength)
    • resize

      public static int[] resize(int[] array, int newLength)
    • resize

      public static byte[] resize(byte[] array, int newLength)
    • removeEntries

      public static String[] removeEntries(String[] array, String value)
    • removeEntries

      public static int[] removeEntries(int[] array, int value)
    • shuffle

      public static void shuffle(int[] array, int from, int to)