java.lang.Object
org.eclipse.xtext.xbase.lib.ArrayExtensions
An extension library for arrays, to be used with Xtend. It allows to use an array without converting it to a list
first.
- Since:
- 2.4
- Author:
- Sven Efftinge - Initial contribution and API, Stephane Galland - Add operations on 2-dimension arrays.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean[]clone(boolean[] array) Clones the array.static byte[]clone(byte[] array) Clones the array.static char[]clone(char[] array) Clones the array.static double[]clone(double[] array) Clones the array.static float[]clone(float[] array) Clones the array.static int[]clone(int[] array) Clones the array.static long[]clone(long[] array) Clones the array.static short[]clone(short[] array) Clones the array.static <T> T[]clone(T[] array) Clones the array.static booleancontains(boolean[] array, boolean value) Returns whether the array contains the given value.static booleancontains(byte[] array, byte value) Returns whether the array contains the given value.static booleancontains(char[] array, char value) Returns whether the array contains the given value.static booleancontains(double[] array, double value) Returns whether the array contains the given value.static booleancontains(float[] array, float value) Returns whether the array contains the given value.static booleancontains(int[] array, int value) Returns whether the array contains the given value.static booleancontains(long[] array, long value) Returns whether the array contains the given value.static booleancontains(short[] array, short value) Returns whether the array contains the given value.static booleanReturns whether the array contains the given element.static booleanReturns whether the array and the given other object are identical.static booleanReturns whether the array and the given other object are identical.static booleanReturns whether the array and the given other object are identical.static booleanReturns whether the array and the given other object are identical.static booleanReturns whether the array and the given other object are identical.static booleanReturns whether the array and the given other object are identical.static booleanReturns whether the array and the given other object are identical.static booleanReturns whether the array and the given other object are identical.static booleanReturns whether the array and the given other object are identical.static booleanget(boolean[][] array, int index0, int index1) static booleanget(boolean[] array, int index) static byteget(byte[][] array, int index0, int index1) static byteget(byte[] array, int index) static charget(char[][] array, int index0, int index1) static charget(char[] array, int index) static doubleget(double[][] array, int index0, int index1) static doubleget(double[] array, int index) static floatget(float[][] array, int index0, int index1) static floatget(float[] array, int index) static intget(int[][] array, int index0, int index1) static intget(int[] array, int index) static longget(long[][] array, int index0, int index1) static longget(long[] array, int index) static shortget(short[][] array, int index0, int index1) static shortget(short[] array, int index) static <T> Tget(T[][] array, int index0, int index1) static <T> Tget(T[] array, int index) static inthashCode(boolean[] array) Returns a hash code value for the given array.static inthashCode(byte[] array) Returns a hash code value for the given array.static inthashCode(char[] array) Returns a hash code value for the given array.static inthashCode(double[] array) Returns a hash code value for the given array.static inthashCode(float[] array) Returns a hash code value for the given array.static inthashCode(int[] array) Returns a hash code value for the given array.static inthashCode(long[] array) Returns a hash code value for the given array.static inthashCode(short[] array) Returns a hash code value for the given array.static intReturns a hash code value for the given array.static intlength(boolean[] array) static intlength(byte[] array) static intlength(char[] array) static intlength(double[] array) static intlength(float[] array) static intlength(int[] array) static intlength(long[] array) static intlength(short[] array) static intstatic booleanset(boolean[][] array, int index0, int index1, boolean value) static booleanset(boolean[] array, int index, boolean value) static byteset(byte[][] array, int index0, int index1, byte value) static byteset(byte[] array, int index, byte value) static charset(char[][] array, int index0, int index1, char value) static charset(char[] array, int index, char value) static doubleset(double[][] array, int index0, int index1, double value) static doubleset(double[] array, int index, double value) static floatset(float[][] array, int index0, int index1, float value) static floatset(float[] array, int index, float value) static intset(int[][] array, int index0, int index1, int value) static intset(int[] array, int index, int value) static longset(long[][] array, int index0, int index1, long value) static longset(long[] array, int index, long value) static shortset(short[][] array, int index0, int index1, short value) static shortset(short[] array, int index, short value) static <T,E extends T>
Tset(T[][] array, int index0, int index1, E value) static <T,E extends T>
Tset(T[] array, int index, E value)
-
Constructor Details
-
ArrayExtensions
public ArrayExtensions()
-
-
Method Details
-
set
public static <T,E extends T> T set(T[] array, int index, E value) - Parameters:
array- the arrayindex- the index the value should be set atvalue- the value to set at the given index- Returns:
- the new value
- Since:
- 2.4
-
get
- Parameters:
array- the arrayindex- the index- Returns:
- the value at the given index
-
clone
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
length
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
Returns whether the array and the given other object are identical. Delegates toObject.equals(Object)- Parameters:
array- the arrayother- the other element to compare to- Returns:
- whether the two given argument are identical
- Since:
- 2.5
-
contains
Returns whether the array contains the given element. More formally, returns true if and only if this array contains at least one element e such that (o==null ? e==null : o.equals(e)).- Parameters:
array- the array to testo- element whose presence in this array is to be tested- Returns:
- true if this array contains the specified element
-
get
- Parameters:
array- the arrayindex- the index- Returns:
- the value at the given index
-
set
public static boolean set(boolean[] array, int index, boolean value) - Parameters:
array- the arrayindex- the index the value should be set atvalue- the value to set at the given index- Returns:
- the new value
-
length
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
Returns whether the array and the given other object are identical. Delegates toObject.equals(Object)- Parameters:
array- the arrayother- the other element to compare to- Returns:
- whether the two given argument are identical
- Since:
- 2.5
-
clone
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
Returns whether the array contains the given value. More formally, returns true if and only if this array contains at least one element e such that value==e.- Parameters:
array- the array to testvalue- value whose presence in this array is to be tested- Returns:
- true if this array contains the specified element
-
get
- Parameters:
array- the arrayindex- the index- Returns:
- the value at the given index
-
set
public static double set(double[] array, int index, double value) - Parameters:
array- the arrayindex- the index the value should be set atvalue- the value to set at the given index- Returns:
- the new value
-
length
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
Returns whether the array and the given other object are identical. Delegates toObject.equals(Object)- Parameters:
array- the arrayother- the other element to compare to- Returns:
- whether the two given argument are identical
- Since:
- 2.5
-
clone
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
Returns whether the array contains the given value. More formally, returns true if and only if this array contains at least one element e such that java.lang.Double.compare(o, e) == 0).- Parameters:
array- the array to testvalue- value whose presence in this array is to be tested- Returns:
- true if this array contains the specified element
-
get
- Parameters:
array- the arrayindex- the index- Returns:
- the value at the given index
-
set
public static float set(float[] array, int index, float value) - Parameters:
array- the arrayindex- the index the value should be set atvalue- the value to set at the given index- Returns:
- the new value
-
length
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
Returns whether the array and the given other object are identical. Delegates toObject.equals(Object)- Parameters:
array- the arrayother- the other element to compare to- Returns:
- whether the two given argument are identical
- Since:
- 2.5
-
clone
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
Returns whether the array contains the given value. More formally, returns true if and only if this array contains at least one element e such that java.lang.Float.compare(o, e) == 0).- Parameters:
array- the array to testvalue- value whose presence in this array is to be tested- Returns:
- true if this array contains the specified element
-
get
- Parameters:
array- the arrayindex- the index- Returns:
- the value at the given index
-
set
public static long set(long[] array, int index, long value) - Parameters:
array- the arrayindex- the index the value should be set atvalue- the value to set at the given index- Returns:
- the new value
-
length
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
Returns whether the array and the given other object are identical. Delegates toObject.equals(Object)- Parameters:
array- the arrayother- the other element to compare to- Returns:
- whether the two given argument are identical
- Since:
- 2.5
-
clone
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
Returns whether the array contains the given value. More formally, returns true if and only if this array contains at least one element e such that (value == e).- Parameters:
array- the array to testvalue- element whose presence in this array is to be tested- Returns:
- true if this array contains the specified element
-
get
- Parameters:
array- the arrayindex- the index- Returns:
- the value at the given index
-
set
public static int set(int[] array, int index, int value) - Parameters:
array- the arrayindex- the index the value should be set atvalue- the value to set at the given index- Returns:
- the new value
-
length
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
Returns whether the array and the given other object are identical. Delegates toObject.equals(Object)- Parameters:
array- the arrayother- the other element to compare to- Returns:
- whether the two given argument are identical
- Since:
- 2.5
-
clone
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
Returns whether the array contains the given value. More formally, returns true if and only if this array contains at least one element e such that (value == e).- Parameters:
array- the array to testvalue- value whose presence in this array is to be tested- Returns:
- true if this array contains the specified element
-
get
- Parameters:
array- the arrayindex- the index- Returns:
- the value at the given index
-
set
public static char set(char[] array, int index, char value) - Parameters:
array- the arrayindex- the index the value should be set atvalue- the value to set at the given index- Returns:
- the new value
-
length
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
Returns whether the array and the given other object are identical. Delegates toObject.equals(Object)- Parameters:
array- the arrayother- the other element to compare to- Returns:
- whether the two given argument are identical
- Since:
- 2.5
-
clone
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
Returns whether the array contains the given value. More formally, returns true if and only if this array contains at least one element e such that (value == e).- Parameters:
array- the array to testvalue- value whose presence in this array is to be tested- Returns:
- true if this array contains the specified element
-
get
- Parameters:
array- the arrayindex- the index- Returns:
- the value at the given index
-
set
public static short set(short[] array, int index, short value) - Parameters:
array- the arrayindex- the index the value should be set atvalue- the value to set at the given index- Returns:
- the new value
-
length
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
Returns whether the array and the given other object are identical. Delegates toObject.equals(Object)- Parameters:
array- the arrayother- the other element to compare to- Returns:
- whether the two given argument are identical
- Since:
- 2.5
-
clone
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
Returns whether the array contains the given value. More formally, returns true if and only if this array contains at least one element e such that (value == e).- Parameters:
array- the array to testvalue- value whose presence in this array is to be tested- Returns:
- true if this array contains the specified element
-
get
- Parameters:
array- the arrayindex- the index- Returns:
- the value at the given index
-
set
public static byte set(byte[] array, int index, byte value) - Parameters:
array- the arrayindex- the index the value should be set atvalue- the value to set at the given index- Returns:
- the new value
-
length
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
Returns whether the array and the given other object are identical. Delegates toObject.equals(Object)- Parameters:
array- the arrayother- the other element to compare to- Returns:
- whether the two given argument are identical
- Since:
- 2.5
-
clone
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
Returns whether the array contains the given value. More formally, returns true if and only if this array contains at least one element e such that (value == e).- Parameters:
array- the array to testvalue- value whose presence in this array is to be tested- Returns:
- true if this array contains the specified element
-
get
- Parameters:
array- the arrayindex0- the first indexindex1- the second index- Returns:
- the value at the given index
- Since:
- 2.16
-
set
public static <T,E extends T> T set(T[][] array, int index0, int index1, E value) - Parameters:
array- the arrayindex0- the first index the value should be set atindex1- the second index the value should be set atvalue- the value to set at the given indexes- Returns:
- the new value
- Since:
- 2.16
-
get
- Parameters:
array- the arrayindex0- the first indexindex1- the second index- Returns:
- the value at the given indexes
- Since:
- 2.16
-
set
public static boolean set(boolean[][] array, int index0, int index1, boolean value) - Parameters:
array- the arrayindex0- the first index the value should be set atindex1- the second index the value should be set atvalue- the value to set at the given indexes- Returns:
- the new value
- Since:
- 2.16
-
get
- Parameters:
array- the arrayindex0- the first indexindex1- the second index- Returns:
- the value at the given indexes
- Since:
- 2.16
-
set
public static double set(double[][] array, int index0, int index1, double value) - Parameters:
array- the arrayindex0- the first index the value should be set atindex1- the second index the value should be set atvalue- the value to set at the given indexex- Returns:
- the new value
- Since:
- 2.16
-
get
- Parameters:
array- the arrayindex0- the first indexindex1- the first index- Returns:
- the value at the given indexes
- Since:
- 2.16
-
set
public static float set(float[][] array, int index0, int index1, float value) - Parameters:
array- the arrayindex0- the first index the value should be set atindex1- the second index the value should be set atvalue- the value to set at the given indexes- Returns:
- the new value
- Since:
- 2.16
-
get
- Parameters:
array- the arrayindex0- the first indexindex1- the second index- Returns:
- the value at the given indexes
- Since:
- 2.16
-
set
public static long set(long[][] array, int index0, int index1, long value) - Parameters:
array- the arrayindex0- the first index the value should be set atindex1- the second index the value should be set atvalue- the value to set at the given indexes- Returns:
- the new value
- Since:
- 2.16
-
get
- Parameters:
array- the arrayindex0- the first indexindex1- the second index- Returns:
- the value at the given indexes
- Since:
- 2.16
-
set
public static int set(int[][] array, int index0, int index1, int value) - Parameters:
array- the arrayindex0- the first index the value should be set atindex1- the second index the value should be set atvalue- the value to set at the given index- Returns:
- the new value
- Since:
- 2.16
-
get
- Parameters:
array- the arrayindex0- the first indexindex1- the second index- Returns:
- the value at the given indexes
- Since:
- 2.16
-
set
public static char set(char[][] array, int index0, int index1, char value) - Parameters:
array- the arrayindex0- the first index the value should be set atindex1- the second index the value should be set atvalue- the value to set at the given indexes- Returns:
- the new value
- Since:
- 2.16
-
get
- Parameters:
array- the arrayindex0- the first indexindex1- the second index- Returns:
- the value at the given indexes
- Since:
- 2.16
-
set
public static short set(short[][] array, int index0, int index1, short value) - Parameters:
array- the arrayindex0- the first index the value should be set atindex1- the second index the value should be set atvalue- the value to set at the given indexes- Returns:
- the new value
- Since:
- 2.16
-
get
- Parameters:
array- the arrayindex0- the first indexindex1- the second index- Returns:
- the value at the given indexes
- Since:
- 2.16
-
set
public static byte set(byte[][] array, int index0, int index1, byte value) - Parameters:
array- the arrayindex0- the first index the value should be set atindex1- the second index the value should be set atvalue- the value to set at the given indexes- Returns:
- the new value
- Since:
- 2.16
-