Class ArrayUtil
- java.lang.Object
-
- elki.utilities.datastructures.arrays.ArrayUtil
-
public class ArrayUtil extends java.lang.Object
Utility functions for manipulating arrays.- Since:
- 0.8.0
- Author:
- Erich Schubert
-
-
Constructor Summary
Constructors Constructor Description ArrayUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
randomShuffle(byte[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.static void
randomShuffle(double[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.static void
randomShuffle(float[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.static void
randomShuffle(int[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.static void
randomShuffle(short[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.static <T> void
randomShuffle(java.util.ArrayList<T> data, java.util.Random random, int limit)
Random shuffle (part) of an array.static <T> void
randomShuffle(T[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.static void
swap(byte[] data, int i, int j)
Swap two values in a byte array.static void
swap(double[] data, int i, int j)
Swap two values in a double array.static void
swap(float[] data, int i, int j)
Swap two values in a float array.static void
swap(int[] data, int i, int j)
Swap two values in an integer array.static void
swap(short[] data, int i, int j)
Swap two values in a short array.static <T> void
swap(java.util.ArrayList<T> data, int i, int j)
Swap two values in an object array.static <T> void
swap(T[] data, int i, int j)
Swap two values in an object array.
-
-
-
Method Detail
-
swap
public static <T> void swap(java.util.ArrayList<T> data, int i, int j)
Swap two values in an object array.- Type Parameters:
T
- Object type- Parameters:
data
- Datai
- First positionj
- Second position
-
swap
public static <T> void swap(T[] data, int i, int j)
Swap two values in an object array.- Type Parameters:
T
- Object type- Parameters:
data
- Datai
- First positionj
- Second position
-
swap
public static void swap(int[] data, int i, int j)
Swap two values in an integer array.- Parameters:
data
- Datai
- First positionj
- Second position
-
swap
public static void swap(short[] data, int i, int j)
Swap two values in a short array.- Parameters:
data
- Datai
- First positionj
- Second position
-
swap
public static void swap(byte[] data, int i, int j)
Swap two values in a byte array.- Parameters:
data
- Datai
- First positionj
- Second position
-
swap
public static void swap(double[] data, int i, int j)
Swap two values in a double array.- Parameters:
data
- Datai
- First positionj
- Second position
-
swap
public static void swap(float[] data, int i, int j)
Swap two values in a float array.- Parameters:
data
- Datai
- First positionj
- Second position
-
randomShuffle
public static void randomShuffle(int[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.- Parameters:
data
- Input arrayrandom
- Random generatorlimit
- Number of elements to randomize
-
randomShuffle
public static void randomShuffle(short[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.- Parameters:
data
- Input arrayrandom
- Random generatorlimit
- Number of elements to randomize
-
randomShuffle
public static void randomShuffle(byte[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.- Parameters:
data
- Input arrayrandom
- Random generatorlimit
- Number of elements to randomize
-
randomShuffle
public static void randomShuffle(double[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.- Parameters:
data
- Input arrayrandom
- Random generatorlimit
- Number of elements to randomize
-
randomShuffle
public static void randomShuffle(float[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.- Parameters:
data
- Input arrayrandom
- Random generatorlimit
- Number of elements to randomize
-
randomShuffle
public static <T> void randomShuffle(T[] data, java.util.Random random, int limit)
Random shuffle (part) of an array.- Type Parameters:
T
- Array object type- Parameters:
data
- Input arrayrandom
- Random generatorlimit
- Number of elements to randomize
-
randomShuffle
public static <T> void randomShuffle(java.util.ArrayList<T> data, java.util.Random random, int limit)
Random shuffle (part) of an array.- Type Parameters:
T
- Array object type- Parameters:
data
- Input arrayrandom
- Random generatorlimit
- Number of elements to randomize
-
-