org.eclipse.xtext.xbase.lib
Class ArrayExtensions

java.lang.Object
  extended by org.eclipse.xtext.xbase.lib.ArrayExtensions

public class ArrayExtensions
extends Object

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

Constructor Summary
ArrayExtensions()
           
 
Method Summary
static boolean get(boolean[] array, int index)
           
static byte get(byte[] array, int index)
           
static char get(char[] array, int index)
           
static double get(double[] array, int index)
           
static float get(float[] array, int index)
           
static int get(int[] array, int index)
           
static long get(long[] array, int index)
           
static short get(short[] array, int index)
           
static
<T> T
get(T[] array, int index)
           
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(Object[] array)
           
static int length(short[] array)
           
static void set(boolean[] array, int index, boolean value)
           
static void set(byte[] array, int index, byte value)
           
static void set(char[] array, int index, char value)
           
static void set(double[] array, int index, double value)
           
static void set(float[] array, int index, float value)
           
static void set(int[] array, int index, int value)
           
static void set(long[] array, int index, long value)
           
static void set(short[] array, int index, short value)
           
static
<T> void
set(T[] array, int index, T value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayExtensions

public ArrayExtensions()
Method Detail

length

@Pure
public static int length(Object[] array)
Parameters:
array - the array
Returns:
the length of the given array

set

public static <T> void set(T[] array,
                           int index,
                           T value)
Parameters:
array - the array
index - the index the value should be set at
value - the value to set at the given index

get

@Pure
public static <T> T get(T[] array,
                             int index)
Parameters:
array - the array
index - the index
Returns:
the value at the given index

length

@Pure
public static int length(byte[] array)
Parameters:
array - the array
Returns:
the length of the given array

set

public static void set(byte[] array,
                       int index,
                       byte value)
Parameters:
array - the array
index - the index the value should be set at
value - the value to set at the given index

get

@Pure
public static byte get(byte[] array,
                            int index)
Parameters:
array - the array
index - the index
Returns:
the value at the given index

length

@Pure
public static int length(short[] array)
Parameters:
array - the array
Returns:
the length of the given array

set

public static void set(short[] array,
                       int index,
                       short value)
Parameters:
array - the array
index - the index the value should be set at
value - the value to set at the given index

get

@Pure
public static short get(short[] array,
                             int index)
Parameters:
array - the array
index - the index
Returns:
the value at the given index

length

@Pure
public static int length(char[] array)
Parameters:
array - the array
Returns:
the length of the given array

set

public static void set(char[] array,
                       int index,
                       char value)
Parameters:
array - the array
index - the index the value should be set at
value - the value to set at the given index

get

@Pure
public static char get(char[] array,
                            int index)
Parameters:
array - the array
index - the index
Returns:
the value at the given index

length

@Pure
public static int length(int[] array)
Parameters:
array - the array
Returns:
the length of the given array

set

public static void set(int[] array,
                       int index,
                       int value)
Parameters:
array - the array
index - the index the value should be set at
value - the value to set at the given index

get

@Pure
public static int get(int[] array,
                           int index)
Parameters:
array - the array
index - the index
Returns:
the value at the given index

length

@Pure
public static int length(long[] array)
Parameters:
array - the array
Returns:
the length of the given array

set

public static void set(long[] array,
                       int index,
                       long value)
Parameters:
array - the array
index - the index the value should be set at
value - the value to set at the given index

get

@Pure
public static long get(long[] array,
                            int index)
Parameters:
array - the array
index - the index
Returns:
the value at the given index

length

@Pure
public static int length(float[] array)
Parameters:
array - the array
Returns:
the length of the given array

set

public static void set(float[] array,
                       int index,
                       float value)
Parameters:
array - the array
index - the index the value should be set at
value - the value to set at the given index

get

@Pure
public static float get(float[] array,
                             int index)
Parameters:
array - the array
index - the index
Returns:
the value at the given index

length

@Pure
public static int length(double[] array)
Parameters:
array - the array
Returns:
the length of the given array

set

public static void set(double[] array,
                       int index,
                       double value)
Parameters:
array - the array
index - the index the value should be set at
value - the value to set at the given index

get

@Pure
public static double get(double[] array,
                              int index)
Parameters:
array - the array
index - the index
Returns:
the value at the given index

length

@Pure
public static int length(boolean[] array)
Parameters:
array - the array
Returns:
the length of the given array

set

public static void set(boolean[] array,
                       int index,
                       boolean value)
Parameters:
array - the array
index - the index the value should be set at
value - the value to set at the given index

get

@Pure
public static boolean get(boolean[] array,
                               int index)
Parameters:
array - the array
index - the index
Returns:
the value at the given index


Copyright © 2013. All Rights Reserved.