Class ArrayUtils

java.lang.Object
net.dermetfan.utils.ArrayUtils
net.dermetfan.gdx.utils.ArrayUtils

public class ArrayUtils
extends ArrayUtils
array utility methods
Since:
0.5.0
  • Constructor Summary

    Constructors
    Constructor Description
    ArrayUtils()  
  • Method Summary

    Modifier and Type Method Description
    static <T> boolean equalsAny​(T obj, com.badlogic.gdx.utils.Array<T> array)  
    static <T> T getRepeated​(com.badlogic.gdx.utils.Array<T> array, int index)  
    static float getRepeated​(com.badlogic.gdx.utils.FloatArray array, int index)  
    static int getRepeated​(com.badlogic.gdx.utils.IntArray array, int index)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int everyXth)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int[] indices)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int[] indices, int indicesOffset, int indicesLength, com.badlogic.gdx.utils.Array<T> dest)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int[] indices, com.badlogic.gdx.utils.Array<T> dest)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int start, int everyXth)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int offset, int length, int start, int everyXth)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int offset, int length, int start, int everyXth, com.badlogic.gdx.utils.Array<T> dest)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int start, int everyXth, com.badlogic.gdx.utils.Array<T> dest)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int everyXth, com.badlogic.gdx.utils.Array<T> dest)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, com.badlogic.gdx.utils.IntArray indices)  
    static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, com.badlogic.gdx.utils.IntArray indices, com.badlogic.gdx.utils.Array<T> dest)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int everyXth)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int[] indices)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int[] indices, int indicesOffset, int indicesLength, com.badlogic.gdx.utils.FloatArray dest)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int[] indices, com.badlogic.gdx.utils.FloatArray dest)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int start, int everyXth)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int offset, int length, int start, int everyXth)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int offset, int length, int start, int everyXth, com.badlogic.gdx.utils.FloatArray dest)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int start, int everyXth, com.badlogic.gdx.utils.FloatArray dest)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int everyXth, com.badlogic.gdx.utils.FloatArray dest)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, com.badlogic.gdx.utils.IntArray indices)  
    static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, com.badlogic.gdx.utils.IntArray indices, com.badlogic.gdx.utils.FloatArray dest)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int everyXth)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int[] indices)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int[] indices, int indicesOffset, int indicesLength, com.badlogic.gdx.utils.IntArray dest)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int[] indices, com.badlogic.gdx.utils.IntArray dest)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int start, int everyXth)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int offset, int length, int start, int everyXth)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int offset, int length, int start, int everyXth, com.badlogic.gdx.utils.IntArray dest)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int start, int everyXth, com.badlogic.gdx.utils.IntArray dest)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int everyXth, com.badlogic.gdx.utils.IntArray dest)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, com.badlogic.gdx.utils.IntArray indices)  
    static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, com.badlogic.gdx.utils.IntArray indices, com.badlogic.gdx.utils.IntArray dest)  
    static <T> com.badlogic.gdx.utils.Array<T> skipselect​(com.badlogic.gdx.utils.Array<T> elements, int firstSkip, int skips)  
    static <T> com.badlogic.gdx.utils.Array<T> skipselect​(com.badlogic.gdx.utils.Array<T> elements, int firstSkip, int skips, com.badlogic.gdx.utils.Array<T> output)
    Like skipselect(Array, IntArray, IntArray) with a skips array that contains only firstSkip and an infinite repeatSkips array which elements are all skips.
    static <T> com.badlogic.gdx.utils.Array<T> skipselect​(com.badlogic.gdx.utils.Array<T> elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips)  
    static <T> com.badlogic.gdx.utils.Array<T> skipselect​(com.badlogic.gdx.utils.Array<T> elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips, com.badlogic.gdx.utils.Array<T> output)
    Skips, selects and goes to the next element repeatedly.
    static com.badlogic.gdx.utils.FloatArray skipselect​(com.badlogic.gdx.utils.FloatArray elements, int firstSkip, int skips)  
    static com.badlogic.gdx.utils.FloatArray skipselect​(com.badlogic.gdx.utils.FloatArray elements, int firstSkip, int skips, com.badlogic.gdx.utils.FloatArray output)
    Like skipselect(Array, IntArray, IntArray) with a skips array that contains only firstSkip and an infinite repeatSkips array which elements are all skips.
    static com.badlogic.gdx.utils.FloatArray skipselect​(com.badlogic.gdx.utils.FloatArray elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips)  
    static com.badlogic.gdx.utils.FloatArray skipselect​(com.badlogic.gdx.utils.FloatArray elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips, com.badlogic.gdx.utils.FloatArray output)
    Skips, selects and goes to the next element repeatedly.
    static com.badlogic.gdx.utils.IntArray skipselect​(com.badlogic.gdx.utils.IntArray elements, int firstSkip, int skips)  
    static com.badlogic.gdx.utils.IntArray skipselect​(com.badlogic.gdx.utils.IntArray elements, int firstSkip, int skips, com.badlogic.gdx.utils.IntArray output)
    Like skipselect(Array, IntArray, IntArray) with a skips array that contains only firstSkip and an infinite repeatSkips array which elements are all skips.
    static com.badlogic.gdx.utils.IntArray skipselect​(com.badlogic.gdx.utils.IntArray elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips)  
    static com.badlogic.gdx.utils.IntArray skipselect​(com.badlogic.gdx.utils.IntArray elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips, com.badlogic.gdx.utils.IntArray output)
    Skips, selects and goes to the next element repeatedly.

    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

    • getRepeated

      public static <T> T getRepeated​(com.badlogic.gdx.utils.Array<T> array, int index)
      See Also:
      ArrayUtils.getRepeated(Object[], int)
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int offset, int length, int start, int everyXth, com.badlogic.gdx.utils.Array<T> dest)
      Parameters:
      items - the items to select from
      start - the array index at which to start (may be negative)
      everyXth - select every xth of items
      dest - The array to put the values in. May be null.
      Returns:
      the dest array or a new array (if dest was null) containing everyXth item of the given items array
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int start, int everyXth, com.badlogic.gdx.utils.Array<T> dest)
      See Also:
      select(Array, int, int, int, int, Array)
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int everyXth, com.badlogic.gdx.utils.Array<T> dest)
      See Also:
      select(Array, int, int, Array)
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int offset, int length, int start, int everyXth)
      See Also:
      select(Array, int, int, int, int, Array)
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int start, int everyXth)
      See Also:
      select(Array, int, int, int, int)
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int everyXth)
      See Also:
      select(Array, int, int)
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int[] indices, int indicesOffset, int indicesLength, com.badlogic.gdx.utils.Array<T> dest)
      Parameters:
      items - the items to select from
      indices - the indices to select
      dest - the array to fill
      Returns:
      the given dest array
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int[] indices, com.badlogic.gdx.utils.Array<T> dest)
      See Also:
      select(Array, int[], int, int, Array)
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, int[] indices)
      See Also:
      ArrayUtils.select(Object[], int[], Object[])
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, com.badlogic.gdx.utils.IntArray indices, com.badlogic.gdx.utils.Array<T> dest)
      See Also:
      select(Array, int[], int, int, Array)
    • select

      public static <T> com.badlogic.gdx.utils.Array<T> select​(com.badlogic.gdx.utils.Array<T> items, com.badlogic.gdx.utils.IntArray indices)
      See Also:
      select(Array, IntArray, Array)
    • skipselect

      public static <T> com.badlogic.gdx.utils.Array<T> skipselect​(com.badlogic.gdx.utils.Array<T> elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips, com.badlogic.gdx.utils.Array<T> output)
      Skips, selects and goes to the next element repeatedly. Stops when elements has no more values. When skips has no more values, repeatSkips will be used repeatedly.
      If the length of the selection is the length of the given elements, elements is returned.
      Parameters:
      elements - the elements from which to select not skipped ones
      skips - the number of indices to skip after each selection
      repeatSkips - The skips to use repeatedly after skips has no more values. If this is null, no more elements will be selected.
      output - the array to fill
      Returns:
      the elements that were not skipped
    • skipselect

      public static <T> com.badlogic.gdx.utils.Array<T> skipselect​(com.badlogic.gdx.utils.Array<T> elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips)
      See Also:
      skipselect(Array, IntArray, IntArray, Array)
    • skipselect

      public static <T> com.badlogic.gdx.utils.Array<T> skipselect​(com.badlogic.gdx.utils.Array<T> elements, int firstSkip, int skips, com.badlogic.gdx.utils.Array<T> output)
      Like skipselect(Array, IntArray, IntArray) with a skips array that contains only firstSkip and an infinite repeatSkips array which elements are all skips. If skips is smaller than 1, elements will be returned.
      See Also:
      skipselect(Array, IntArray, IntArray)
    • skipselect

      public static <T> com.badlogic.gdx.utils.Array<T> skipselect​(com.badlogic.gdx.utils.Array<T> elements, int firstSkip, int skips)
      See Also:
      skipselect(Array, int, int, Array)
    • equalsAny

      public static <T> boolean equalsAny​(T obj, com.badlogic.gdx.utils.Array<T> array)
      See Also:
      ArrayUtils.equalsAny(Object, Object[])
    • getRepeated

      public static int getRepeated​(com.badlogic.gdx.utils.IntArray array, int index)
      See Also:
      ArrayUtils.getRepeated(int[], int)
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int offset, int length, int start, int everyXth, com.badlogic.gdx.utils.IntArray dest)
      Parameters:
      items - the items to select from
      start - the array index at which to start (may be negative)
      everyXth - select every xth of items
      dest - The array to put the values in. May be null.
      Returns:
      the dest array or a new array (if dest was null) containing everyXth item of the given items array
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int start, int everyXth, com.badlogic.gdx.utils.IntArray dest)
      See Also:
      select(Array, int, int, int, int, Array)
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int everyXth, com.badlogic.gdx.utils.IntArray dest)
      See Also:
      select(Array, int, int, Array)
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int offset, int length, int start, int everyXth)
      See Also:
      select(Array, int, int, int, int, Array)
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int start, int everyXth)
      See Also:
      select(Array, int, int, int, int)
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int everyXth)
      See Also:
      select(Array, int, int)
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int[] indices, int indicesOffset, int indicesLength, com.badlogic.gdx.utils.IntArray dest)
      Parameters:
      items - the items to select from
      indices - the indices to select
      dest - the array to fill
      Returns:
      the given dest array
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int[] indices, com.badlogic.gdx.utils.IntArray dest)
      See Also:
      select(Array, int[], int, int, Array)
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, int[] indices)
      See Also:
      ArrayUtils.select(Object[], int[], Object[])
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, com.badlogic.gdx.utils.IntArray indices, com.badlogic.gdx.utils.IntArray dest)
      See Also:
      select(Array, int[], int, int, Array)
    • select

      public static com.badlogic.gdx.utils.IntArray select​(com.badlogic.gdx.utils.IntArray items, com.badlogic.gdx.utils.IntArray indices)
      See Also:
      select(Array, IntArray, Array)
    • skipselect

      public static com.badlogic.gdx.utils.IntArray skipselect​(com.badlogic.gdx.utils.IntArray elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips, com.badlogic.gdx.utils.IntArray output)
      Skips, selects and goes to the next element repeatedly. Stops when elements has no more values. When skips has no more values, repeatSkips will be used repeatedly.
      If the length of the selection is the length of the given elements, elements is returned.
      Parameters:
      elements - the elements from which to select not skipped ones
      skips - the number of indices to skip after each selection
      repeatSkips - The skips to use repeatedly after skips has no more values. If this is null, no more elements will be selected.
      output - the array to fill
      Returns:
      the elements that were not skipped
    • skipselect

      public static com.badlogic.gdx.utils.IntArray skipselect​(com.badlogic.gdx.utils.IntArray elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips)
      See Also:
      skipselect(Array, IntArray, IntArray, Array)
    • skipselect

      public static com.badlogic.gdx.utils.IntArray skipselect​(com.badlogic.gdx.utils.IntArray elements, int firstSkip, int skips, com.badlogic.gdx.utils.IntArray output)
      Like skipselect(Array, IntArray, IntArray) with a skips array that contains only firstSkip and an infinite repeatSkips array which elements are all skips. If skips is smaller than 1, elements will be returned.
      See Also:
      skipselect(Array, IntArray, IntArray)
    • skipselect

      public static com.badlogic.gdx.utils.IntArray skipselect​(com.badlogic.gdx.utils.IntArray elements, int firstSkip, int skips)
      See Also:
      skipselect(Array, int, int, Array)
    • getRepeated

      public static float getRepeated​(com.badlogic.gdx.utils.FloatArray array, int index)
      See Also:
      ArrayUtils.getRepeated(float[], int)
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int offset, int length, int start, int everyXth, com.badlogic.gdx.utils.FloatArray dest)
      Parameters:
      items - the items to select from
      start - the array index at which to start (may be negative)
      everyXth - select every xth of items
      dest - The array to put the values in. May be null.
      Returns:
      the dest array or a new array (if dest was null) containing everyXth item of the given items array
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int start, int everyXth, com.badlogic.gdx.utils.FloatArray dest)
      See Also:
      select(Array, int, int, int, int, Array)
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int everyXth, com.badlogic.gdx.utils.FloatArray dest)
      See Also:
      select(Array, int, int, Array)
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int offset, int length, int start, int everyXth)
      See Also:
      select(Array, int, int, int, int, Array)
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int start, int everyXth)
      See Also:
      select(Array, int, int, int, int)
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int everyXth)
      See Also:
      select(Array, int, int)
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int[] indices, int indicesOffset, int indicesLength, com.badlogic.gdx.utils.FloatArray dest)
      Parameters:
      items - the items to select from
      indices - the indices to select
      dest - the array to fill
      Returns:
      the given dest array
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int[] indices, com.badlogic.gdx.utils.FloatArray dest)
      See Also:
      select(Array, int[], int, int, Array)
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, int[] indices)
      See Also:
      ArrayUtils.select(Object[], int[], Object[])
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, com.badlogic.gdx.utils.IntArray indices, com.badlogic.gdx.utils.FloatArray dest)
      See Also:
      select(Array, int[], int, int, Array)
    • select

      public static com.badlogic.gdx.utils.FloatArray select​(com.badlogic.gdx.utils.FloatArray items, com.badlogic.gdx.utils.IntArray indices)
      See Also:
      select(Array, IntArray, Array)
    • skipselect

      public static com.badlogic.gdx.utils.FloatArray skipselect​(com.badlogic.gdx.utils.FloatArray elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips, com.badlogic.gdx.utils.FloatArray output)
      Skips, selects and goes to the next element repeatedly. Stops when elements has no more values. When skips has no more values, repeatSkips will be used repeatedly.
      If the length of the selection is the length of the given elements, elements is returned.
      Parameters:
      elements - the elements from which to select not skipped ones
      skips - the number of indices to skip after each selection
      repeatSkips - The skips to use repeatedly after skips has no more values. If this is null, no more elements will be selected.
      output - the array to fill
      Returns:
      the elements that were not skipped
    • skipselect

      public static com.badlogic.gdx.utils.FloatArray skipselect​(com.badlogic.gdx.utils.FloatArray elements, com.badlogic.gdx.utils.IntArray skips, com.badlogic.gdx.utils.IntArray repeatSkips)
      See Also:
      skipselect(Array, IntArray, IntArray, Array)
    • skipselect

      public static com.badlogic.gdx.utils.FloatArray skipselect​(com.badlogic.gdx.utils.FloatArray elements, int firstSkip, int skips, com.badlogic.gdx.utils.FloatArray output)
      Like skipselect(Array, IntArray, IntArray) with a skips array that contains only firstSkip and an infinite repeatSkips array which elements are all skips. If skips is smaller than 1, elements will be returned.
      See Also:
      skipselect(Array, IntArray, IntArray)
    • skipselect

      public static com.badlogic.gdx.utils.FloatArray skipselect​(com.badlogic.gdx.utils.FloatArray elements, int firstSkip, int skips)
      See Also:
      skipselect(Array, int, int, Array)