Package org.eclipse.xtext.xbase.lib
Class ArrayExtensions
- java.lang.Object
-
- org.eclipse.xtext.xbase.lib.ArrayExtensions
-
@GwtCompatible public class ArrayExtensions extends java.lang.ObjectAn 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
-
-
Constructor Summary
Constructors Constructor Description ArrayExtensions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 booleancontains(java.lang.Object[] array, java.lang.Object o)Returns whether the array contains the given element.static booleanequals(boolean[] array, java.lang.Object other)Returns whether the array and the given other object are identical.static booleanequals(byte[] array, java.lang.Object other)Returns whether the array and the given other object are identical.static booleanequals(char[] array, java.lang.Object other)Returns whether the array and the given other object are identical.static booleanequals(double[] array, java.lang.Object other)Returns whether the array and the given other object are identical.static booleanequals(float[] array, java.lang.Object other)Returns whether the array and the given other object are identical.static booleanequals(int[] array, java.lang.Object other)Returns whether the array and the given other object are identical.static booleanequals(long[] array, java.lang.Object other)Returns whether the array and the given other object are identical.static booleanequals(short[] array, java.lang.Object other)Returns whether the array and the given other object are identical.static booleanequals(java.lang.Object[] array, java.lang.Object other)Returns 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 inthashCode(java.lang.Object[] array)Returns 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 intlength(java.lang.Object[] array)static 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)
-
-
-
Method Detail
-
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
@Pure public static <T> T get(T[] array, int index)
- Parameters:
array- the arrayindex- the index- Returns:
- the value at the given index
-
clone
@Pure @GwtIncompatible("clone") public static <T> T[] clone(T[] array)
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
length
@Pure public static int length(java.lang.Object[] array)
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
@Pure public static int hashCode(java.lang.Object[] array)
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
@Pure public static boolean equals(java.lang.Object[] array, java.lang.Object other)
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
@Pure public static boolean contains(java.lang.Object[] array, java.lang.Object o)
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
@Pure public static boolean get(boolean[] array, int index)
- 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
@Pure public static int length(boolean[] array)
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
@Pure public static int hashCode(boolean[] array)
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
@Pure public static boolean equals(boolean[] array, java.lang.Object other)
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
@Pure @GwtIncompatible("clone") public static boolean[] clone(boolean[] array)
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
@Pure public static boolean contains(boolean[] array, boolean value)
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
@Pure public static double get(double[] array, int index)
- 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
@Pure public static int length(double[] array)
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
@Pure public static int hashCode(double[] array)
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
@Pure public static boolean equals(double[] array, java.lang.Object other)
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
@Pure @GwtIncompatible("clone") public static double[] clone(double[] array)
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
@Pure public static boolean contains(double[] array, double value)
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
@Pure public static float get(float[] array, int index)
- 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
@Pure public static int length(float[] array)
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
@Pure public static int hashCode(float[] array)
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
@Pure public static boolean equals(float[] array, java.lang.Object other)
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
@Pure @GwtIncompatible("clone") public static float[] clone(float[] array)
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
@Pure public static boolean contains(float[] array, float value)
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
@Pure public static long get(long[] array, int index)
- 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
@Pure public static int length(long[] array)
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
@Pure public static int hashCode(long[] array)
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
@Pure public static boolean equals(long[] array, java.lang.Object other)
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
@Pure @GwtIncompatible("clone") public static long[] clone(long[] array)
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
@Pure public static boolean contains(long[] array, long value)
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
@Pure public static int get(int[] array, int index)
- 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
@Pure public static int length(int[] array)
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
@Pure public static int hashCode(int[] array)
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
@Pure public static boolean equals(int[] array, java.lang.Object other)
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
@Pure @GwtIncompatible("clone") public static int[] clone(int[] array)
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
@Pure public static boolean contains(int[] array, int value)
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
@Pure public static char get(char[] array, int index)
- 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
@Pure public static int length(char[] array)
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
@Pure public static int hashCode(char[] array)
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
@Pure public static boolean equals(char[] array, java.lang.Object other)
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
@Pure @GwtIncompatible("clone") public static char[] clone(char[] array)
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
@Pure public static boolean contains(char[] array, char value)
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
@Pure public static short get(short[] array, int index)
- 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
@Pure public static int length(short[] array)
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
@Pure public static int hashCode(short[] array)
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
@Pure public static boolean equals(short[] array, java.lang.Object other)
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
@Pure @GwtIncompatible("clone") public static short[] clone(short[] array)
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
@Pure public static boolean contains(short[] array, short value)
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
@Pure public static byte get(byte[] array, int index)
- 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
@Pure public static int length(byte[] array)
- Parameters:
array- the array- Returns:
- the length of the given array
-
hashCode
@Pure public static int hashCode(byte[] array)
Returns a hash code value for the given array.- Parameters:
array- the array- Returns:
- the hash code
- Since:
- 2.5
-
equals
@Pure public static boolean equals(byte[] array, java.lang.Object other)
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
@Pure @GwtIncompatible("clone") public static byte[] clone(byte[] array)
Clones the array. @seeObject.clone()- Parameters:
array- the array- Returns:
- the cloned array
- Since:
- 2.5
-
contains
@Pure public static boolean contains(byte[] array, byte value)
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
@Pure public static <T> T get(T[][] array, int index0, int index1)
- 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
@Pure public static boolean get(boolean[][] array, int index0, int index1)
- 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
@Pure public static double get(double[][] array, int index0, int index1)
- 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
@Pure public static float get(float[][] array, int index0, int index1)
- 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
@Pure public static long get(long[][] array, int index0, int index1)
- 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
@Pure public static int get(int[][] array, int index0, int index1)
- 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
@Pure public static char get(char[][] array, int index0, int index1)
- 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
@Pure public static short get(short[][] array, int index0, int index1)
- 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
@Pure public static byte get(byte[][] array, int index0, int index1)
- 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
-
-