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 boolean
contains
(boolean[] array, boolean value) Returns whether the array contains the given value.static boolean
contains
(byte[] array, byte value) Returns whether the array contains the given value.static boolean
contains
(char[] array, char value) Returns whether the array contains the given value.static boolean
contains
(double[] array, double value) Returns whether the array contains the given value.static boolean
contains
(float[] array, float value) Returns whether the array contains the given value.static boolean
contains
(int[] array, int value) Returns whether the array contains the given value.static boolean
contains
(long[] array, long value) Returns whether the array contains the given value.static boolean
contains
(short[] array, short value) Returns whether the array contains the given value.static boolean
Returns whether the array contains the given element.static boolean
Returns whether the array and the given other object are identical.static boolean
Returns whether the array and the given other object are identical.static boolean
Returns whether the array and the given other object are identical.static boolean
Returns whether the array and the given other object are identical.static boolean
Returns whether the array and the given other object are identical.static boolean
Returns whether the array and the given other object are identical.static boolean
Returns whether the array and the given other object are identical.static boolean
Returns whether the array and the given other object are identical.static boolean
Returns whether the array and the given other object are identical.static boolean
get
(boolean[][] array, int index0, int index1) static boolean
get
(boolean[] array, int index) static byte
get
(byte[][] array, int index0, int index1) static byte
get
(byte[] array, int index) static char
get
(char[][] array, int index0, int index1) static char
get
(char[] array, int index) static double
get
(double[][] array, int index0, int index1) static double
get
(double[] array, int index) static float
get
(float[][] array, int index0, int index1) static float
get
(float[] array, int index) static int
get
(int[][] array, int index0, int index1) static int
get
(int[] array, int index) static long
get
(long[][] array, int index0, int index1) static long
get
(long[] array, int index) static short
get
(short[][] array, int index0, int index1) static short
get
(short[] array, int index) static <T> T
get
(T[][] array, int index0, int index1) static <T> T
get
(T[] array, int index) static int
hashCode
(boolean[] array) Returns a hash code value for the given array.static int
hashCode
(byte[] array) Returns a hash code value for the given array.static int
hashCode
(char[] array) Returns a hash code value for the given array.static int
hashCode
(double[] array) Returns a hash code value for the given array.static int
hashCode
(float[] array) Returns a hash code value for the given array.static int
hashCode
(int[] array) Returns a hash code value for the given array.static int
hashCode
(long[] array) Returns a hash code value for the given array.static int
hashCode
(short[] array) Returns a hash code value for the given array.static int
Returns a hash code value for the given array.static int
length
(boolean[] array) static int
length
(byte[] array) static int
length
(char[] array) static int
length
(double[] array) static int
length
(float[] array) static int
length
(int[] array) static int
length
(long[] array) static int
length
(short[] array) static int
static boolean
set
(boolean[][] array, int index0, int index1, boolean value) static boolean
set
(boolean[] array, int index, boolean value) static byte
set
(byte[][] array, int index0, int index1, byte value) static byte
set
(byte[] array, int index, byte value) static char
set
(char[][] array, int index0, int index1, char value) static char
set
(char[] array, int index, char value) static double
set
(double[][] array, int index0, int index1, double value) static double
set
(double[] array, int index, double value) static float
set
(float[][] array, int index0, int index1, float value) static float
set
(float[] array, int index, float value) static int
set
(int[][] array, int index0, int index1, int value) static int
set
(int[] array, int index, int value) static long
set
(long[][] array, int index0, int index1, long value) static long
set
(long[] array, int index, long value) static short
set
(short[][] array, int index0, int index1, short value) static short
set
(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
-