ArrayUtils

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jagatoo.util.arrays
Class ArrayUtils

    java.lang.Object
      org.jagatoo.util.arrays.ArrayUtils

    public final class ArrayUtils

extends java.lang.Object

Helper class for array operations.

Author:
  Marvin Froehlich (aka Qudus)

Method Summary
`static boolean` | `contains(byte[] array, byte element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(byte[] array, int start, int limit, byte element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(double[] array, double element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(double[] array, int start, int limit, double element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(float[] array, float element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(float[] array, int start, int limit, float element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(int[] array, int element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(int[] array, int start, int limit, int element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(long[] array, int start, int limit, long element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(long[] array, long element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(java.lang.Object[] array, int start, int limit, java.lang.Object element, boolean strict)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(java.lang.Object[] array, java.lang.Object element, boolean strict)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(short[] array, int start, int limit, short element)` Checks, if the specified array contains the specified element.
`static boolean` | `contains(short[] array, short element)` Checks, if the specified array contains the specified element.
`static void` | `dumpArray(byte[] array, boolean handleLikeUnsigned)` Dumps the contents of the given array to stdout (in one line).
`static void` | `dumpArray(byte[] array, boolean handleLikeUnsigned, int maxElemsPerLine)` Dumps the contents of the given array to stdout.
`static void` | `dumpArray(double[] array)` Dumps the contents of the given array to stdout (in one line).
`static void` | `dumpArray(double[] array, int maxElemsPerLine)` Dumps the contents of the given array to stdout.
`static void` | `dumpArray(float[] array)` Dumps the contents of the given array to stdout (in one line).
`static void` | `dumpArray(float[] array, int maxElemsPerLine)` Dumps the contents of the given array to stdout.
`static void` | `dumpArray(int[] array)` Dumps the contents of the given array to stdout (in one line).
`static void` | `dumpArray(int[] array, int maxElemsPerLine)` Dumps the contents of the given array to stdout.
`static void` | `dumpArray(short[] array)` Dumps the contents of the given array to stdout (in one line).
`static void` | `dumpArray(short[] array, int maxElemsPerLine)` Dumps the contents of the given array to stdout.

`static

`<E> E[]`

`

`ensureCapacity(E[] array, java.lang.Class<?> elementType, int minCapacity)`
Ensures, the given int array has the desired length.

`static float[]` | `ensureCapacity(float[] array, int minCapacity)` Ensures, the given int array has the desired length.
`static float[]` | `ensureCapacity(float[] array, int minCapacity, int paddValue)` Ensures, the given int array has the desired length.
`static int[]` | `ensureCapacity(int[] array, int minCapacity)` Ensures, the given int array has the desired length.
`static int[]` | `ensureCapacity(int[] array, int minCapacity, int paddValue)` Ensures, the given int array has the desired length.
`static java.lang.Integer[]` | `ensureCapacity(java.lang.Integer[] array, int minCapacity)` Ensures, the given int array has the desired length.
`static long[]` | `ensureCapacity(long[] array, int minCapacity)` Ensures, the given int array has the desired length.
`static long[]` | `ensureCapacity(long[] array, int minCapacity, int paddValue)` Ensures, the given int array has the desired length.
`static boolean` | `equals(float[] a, float[] b)`
`static int` | `indexOf(byte[] array, byte element)` Searches the specified element inside the specified array.
`static int` | `indexOf(byte[] array, int start, int limit, byte element)` Searches the specified element inside the specified array.
`static int` | `indexOf(double[] array, double element)` Searches the specified element inside the specified array.
`static int` | `indexOf(double[] array, int start, int limit, double element)` Searches the specified element inside the specified array.
`static int` | `indexOf(float[] array, float element)` Searches the specified element inside the specified array.
`static int` | `indexOf(float[] array, int start, int limit, float element)` Searches the specified element inside the specified array.
`static int` | `indexOf(int[] array, int element)` Searches the specified element inside the specified array.
`static int` | `indexOf(int[] array, int start, int limit, int element)` Searches the specified element inside the specified array.
`static int` | `indexOf(long[] array, int start, int limit, long element)` Searches the specified element inside the specified array.
`static int` | `indexOf(long[] array, long element)` Searches the specified element inside the specified array.
`static int` | `indexOf(java.lang.Object[] array, int start, int limit, java.lang.Object element, boolean strict)` Searches the specified element inside the specified array.
`static int` | `indexOf(java.lang.Object[] array, java.lang.Object element, boolean strict)` Searches the specified element inside the specified array.
`static int` | `indexOf(short[] array, int start, int limit, short element)` Searches the specified element inside the specified array.
`static int` | `indexOf(short[] array, short element)` Searches the specified element inside the specified array.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### equals

    public static final boolean equals(float[] a,
                                       float[] b)

  Parameters:
    `a` -
    `b` -
  Returns:
    true, if both float arrays are either the same instance (or both null), or the same langth and all elements are equal.

### dumpArray

    public static final void dumpArray(float[] array,
                                       int maxElemsPerLine)

  Dumps the contents of the given array to stdout.

  Parameters:
    `array` -
    `maxElemsPerLine` -

### dumpArray

    public static final void dumpArray(float[] array)

  Dumps the contents of the given array to stdout (in one line).

  Parameters:
    `array` -

### dumpArray

    public static final void dumpArray(double[] array,
                                       int maxElemsPerLine)

  Dumps the contents of the given array to stdout.

  Parameters:
    `array` -
    `maxElemsPerLine` -

### dumpArray

    public static final void dumpArray(double[] array)

  Dumps the contents of the given array to stdout (in one line).

  Parameters:
    `array` -

### dumpArray

    public static final void dumpArray(int[] array,
                                       int maxElemsPerLine)

  Dumps the contents of the given array to stdout.

  Parameters:
    `array` -
    `maxElemsPerLine` -

### dumpArray

    public static final void dumpArray(int[] array)

  Dumps the contents of the given array to stdout (in one line).

  Parameters:
    `array` -

### dumpArray

    public static final void dumpArray(short[] array,
                                       int maxElemsPerLine)

  Dumps the contents of the given array to stdout.

  Parameters:
    `array` -
    `maxElemsPerLine` -

### dumpArray

    public static final void dumpArray(short[] array)

  Dumps the contents of the given array to stdout (in one line).

  Parameters:
    `array` -

### dumpArray

    public static final void dumpArray(byte[] array,
                                       boolean handleLikeUnsigned,
                                       int maxElemsPerLine)

  Dumps the contents of the given array to stdout.

  Parameters:
    `array` -
    `handleLikeUnsigned` -
    `maxElemsPerLine` -

### dumpArray

    public static final void dumpArray(byte[] array,
                                       boolean handleLikeUnsigned)

  Dumps the contents of the given array to stdout (in one line).

  Parameters:
    `array` -
    `handleLikeUnsigned` -

### ensureCapacity

    public static final int[] ensureCapacity(int[] array,
                                             int minCapacity)

  Ensures, the given int array has the desired length.
  The ensured array is returned!

  Parameters:
    `array` - the input array
    `minCapacity` - the desired (minimal) capacity
  Returns:
    the array with the ensured length

### ensureCapacity

    public static final java.lang.Integer[] ensureCapacity(java.lang.Integer[] array,
                                                           int minCapacity)

  Ensures, the given int array has the desired length.
  The ensured array is returned!

  Parameters:
    `array` - the input array
    `minCapacity` - the desired (minimal) capacity
  Returns:
    the array with the ensured length

### ensureCapacity

    public static final int[] ensureCapacity(int[] array,
                                             int minCapacity,
                                             int paddValue)

  Ensures, the given int array has the desired length.
  The ensured array is returned!

  Parameters:
    `array` - the input array
    `minCapacity` - the desired (minimal) capacity
    `paddValue` - the value to be written to appended elements
  Returns:
    the array with the ensured length

### ensureCapacity

    public static final long[] ensureCapacity(long[] array,
                                              int minCapacity)

  Ensures, the given int array has the desired length.
  The ensured array is returned!

  Parameters:
    `array` - the input array
    `minCapacity` - the desired (minimal) capacity
  Returns:
    the array with the ensured length

### ensureCapacity

    public static final long[] ensureCapacity(long[] array,
                                              int minCapacity,
                                              int paddValue)

  Ensures, the given int array has the desired length.
  The ensured array is returned!

  Parameters:
    `array` - the input array
    `minCapacity` - the desired (minimal) capacity
    `paddValue` - the value to be written to appended elements
  Returns:
    the array with the ensured length

### ensureCapacity

    public static final float[] ensureCapacity(float[] array,
                                               int minCapacity)

  Ensures, the given int array has the desired length.
  The ensured array is returned!

  Parameters:
    `array` - the input array
    `minCapacity` - the desired (minimal) capacity
  Returns:
    the array with the ensured length

### ensureCapacity

    public static final float[] ensureCapacity(float[] array,
                                               int minCapacity,
                                               int paddValue)

  Ensures, the given int array has the desired length.
  The ensured array is returned!

  Parameters:
    `array` - the input array
    `minCapacity` - the desired (minimal) capacity
    `paddValue` - the value to be written to appended elements
  Returns:
    the array with the ensured length

### ensureCapacity

    public static final <E> E[] ensureCapacity(E[] array,
                                               java.lang.Class<?> elementType,
                                               int minCapacity)

  Ensures, the given int array has the desired length.
  The ensured array is returned!

  Type Parameters:
    `E` -
  Parameters:
    `array` - the input array
    `elementType` -
    `minCapacity` - the desired (minimal) capacity
  Returns:
    the array with the ensured length

### contains

    public static final boolean contains(byte[] array,
                                         int start,
                                         int limit,
                                         byte element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(byte[] array,
                                         byte element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(short[] array,
                                         int start,
                                         int limit,
                                         short element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(short[] array,
                                         short element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(int[] array,
                                         int start,
                                         int limit,
                                         int element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(int[] array,
                                         int element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(long[] array,
                                         int start,
                                         int limit,
                                         long element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(long[] array,
                                         long element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(float[] array,
                                         int start,
                                         int limit,
                                         float element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(float[] array,
                                         float element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(double[] array,
                                         int start,
                                         int limit,
                                         double element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(double[] array,
                                         double element)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(java.lang.Object[] array,
                                         int start,
                                         int limit,
                                         java.lang.Object element,
                                         boolean strict)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
    `strict` - if `true`, a == check is used to identify the element, otherwise, the equals method is used.
  Returns:
    `true`, if the array contains the specified element.

### contains

    public static final boolean contains(java.lang.Object[] array,
                                         java.lang.Object element,
                                         boolean strict)

  Checks, if the specified array contains the specified element.

  Parameters:
    `array` - the array to check
    `element` - the element to search
    `strict` - if `true`, a == check is used to identify the element, otherwise, the equals method is used.
  Returns:
    `true`, if the array contains the specified element.

### indexOf

    public static final int indexOf(byte[] array,
                                    int start,
                                    int limit,
                                    byte element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(byte[] array,
                                    byte element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(short[] array,
                                    int start,
                                    int limit,
                                    short element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(short[] array,
                                    short element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(int[] array,
                                    int start,
                                    int limit,
                                    int element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(int[] array,
                                    int element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(long[] array,
                                    int start,
                                    int limit,
                                    long element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(long[] array,
                                    long element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(float[] array,
                                    int start,
                                    int limit,
                                    float element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(float[] array,
                                    float element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(double[] array,
                                    int start,
                                    int limit,
                                    double element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(double[] array,
                                    double element)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `element` - the element to search
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(java.lang.Object[] array,
                                    int start,
                                    int limit,
                                    java.lang.Object element,
                                    boolean strict)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `start` - the index in the source array to start the search at
    `limit` - the index in the source array of the last element to be tested
    `element` - the element to search
    `strict` - if `true`, a == check is used to identify the element, otherwise, the equals method is used.
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

### indexOf

    public static final int indexOf(java.lang.Object[] array,
                                    java.lang.Object element,
                                    boolean strict)

  Searches the specified element inside the specified array.

  Parameters:
    `array` - the array to check
    `element` - the element to search
    `strict` - if `true`, a == check is used to identify the element, otherwise, the equals method is used.
  Returns:
    the element's index within the array or -1, if the array does not contain the specified element.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD