Class RMArrayUtils

java.lang.Object
com.reportmill.base.RMArrayUtils

public class RMArrayUtils extends Object
A collection of array utility methods.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static char[]
    add(char[] array, char value)
    Adds a char value to a char array.
    static char[]
    add(char[] array, char value, int index)
    Adds a char value to a char array at the given index.
    static int[]
    add(int[] array, int value)
    Adds an int value to an int array.
    static int[]
    add(int[] array, int value, int index)
    Adds an int value to an int array at the given index.
    static int[]
    addIfAbsent(int[] array, int value)
    Adds an int value to an int array at the given index if value is absent from array.
    static boolean[]
    clone(boolean[] array)
    Clones a boolean array.
    static byte[]
    clone(byte[] array)
    Clones a byte array.
    static float[]
    clone(float[] array)
    Clones a float array.
    static int[]
    clone(int[] array)
    Clones an int array.
    static boolean
    contains(Object[] anArray, Object anObj)
    Returns whether the given array contains the given object.
    static boolean
    containsIC(Object[] anArray, Object anObj)
    Returns whether the given array contains the given object (assuming strings and case insensitive).
    static boolean
    equals(byte[] array1, byte[] array2)
    Returns whether two byte arrays are equal.
    static boolean
    equals(byte[] array1, byte[] array2, int length)
    Returns whether two byte arrays are equal to the given length.
    static boolean
    equals(float[] array1, float[] array2)
    Returns whether two float arrays are equal.
    static boolean
    equals(int[] array1, int[] array2)
    Returns whether two boolean arrays are equal.
    static int
    indexOf(Object[] anArray, Object anObj)
    Returns the index of the given object in the given array.
    static int
    indexOfIC(Object[] anArray, Object anObj)
    Returns the index of the given object in the given array (assuming strings and ignoring case).
    static byte[]
    realloc(byte[] array, int size)
    Creates a new byte array with original values and new size.
    static int[]
    realloc(int[] array, int size)
    Creates a new int array with original values and new size.
    static Object[]
    realloc(Object[] array, int size)
    Creates a new object array with original values and new size.
    static int[]
    remove(int[] a, int anIndex)
    Removes an int value from an int array.
    static int[]
    remove(int[] a, int start, int end)
    Removes a range of values from an int array.
    static int[]
    replace(int[] array, int start, int end, int[] replacement)
    Replaces a range of values in an int array with values from another int array.

    Methods inherited from class java.lang.Object

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

    • RMArrayUtils

      public RMArrayUtils()
  • Method Details

    • add

      public static char[] add(char[] array, char value)
      Adds a char value to a char array.
    • add

      public static char[] add(char[] array, char value, int index)
      Adds a char value to a char array at the given index.
    • add

      public static int[] add(int[] array, int value)
      Adds an int value to an int array.
    • add

      public static int[] add(int[] array, int value, int index)
      Adds an int value to an int array at the given index.
    • addIfAbsent

      public static int[] addIfAbsent(int[] array, int value)
      Adds an int value to an int array at the given index if value is absent from array.
    • remove

      public static int[] remove(int[] a, int anIndex)
      Removes an int value from an int array.
    • remove

      public static int[] remove(int[] a, int start, int end)
      Removes a range of values from an int array.
    • replace

      public static int[] replace(int[] array, int start, int end, int[] replacement)
      Replaces a range of values in an int array with values from another int array.
    • clone

      public static byte[] clone(byte[] array)
      Clones a byte array.
    • clone

      public static boolean[] clone(boolean[] array)
      Clones a boolean array.
    • clone

      public static int[] clone(int[] array)
      Clones an int array.
    • clone

      public static float[] clone(float[] array)
      Clones a float array.
    • realloc

      public static byte[] realloc(byte[] array, int size)
      Creates a new byte array with original values and new size.
    • realloc

      public static int[] realloc(int[] array, int size)
      Creates a new int array with original values and new size.
    • realloc

      public static Object[] realloc(Object[] array, int size)
      Creates a new object array with original values and new size.
    • equals

      public static boolean equals(byte[] array1, byte[] array2)
      Returns whether two byte arrays are equal.
    • equals

      public static boolean equals(byte[] array1, byte[] array2, int length)
      Returns whether two byte arrays are equal to the given length.
    • equals

      public static boolean equals(int[] array1, int[] array2)
      Returns whether two boolean arrays are equal.
    • equals

      public static boolean equals(float[] array1, float[] array2)
      Returns whether two float arrays are equal.
    • indexOf

      public static int indexOf(Object[] anArray, Object anObj)
      Returns the index of the given object in the given array.
    • indexOfIC

      public static int indexOfIC(Object[] anArray, Object anObj)
      Returns the index of the given object in the given array (assuming strings and ignoring case).
    • contains

      public static boolean contains(Object[] anArray, Object anObj)
      Returns whether the given array contains the given object.
    • containsIC

      public static boolean containsIC(Object[] anArray, Object anObj)
      Returns whether the given array contains the given object (assuming strings and case insensitive).