Arrays
cern.colt

Class Arrays



  • public class Arraysextends Object
    Array manipulations; complements java.util.Arrays.
    See Also:
    Arrays, Sorting
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      static boolean[]ensureCapacity(boolean[] array, int minCapacity)
      Ensures that a given array can hold up to minCapacity elements.
      static byte[]ensureCapacity(byte[] array, int minCapacity)
      Ensures that a given array can hold up to minCapacity elements.
      static char[]ensureCapacity(char[] array, int minCapacity)
      Ensures that a given array can hold up to minCapacity elements.
      static double[]ensureCapacity(double[] array, int minCapacity)
      Ensures that a given array can hold up to minCapacity elements.
      static float[]ensureCapacity(float[] array, int minCapacity)
      Ensures that a given array can hold up to minCapacity elements.
      static int[]ensureCapacity(int[] array, int minCapacity)
      Ensures that a given array can hold up to minCapacity elements.
      static long[]ensureCapacity(long[] array, int minCapacity)
      Ensures that a given array can hold up to minCapacity elements.
      static Object[]ensureCapacity(Object[] array, int minCapacity)
      Ensures that a given array can hold up to minCapacity elements.
      static short[]ensureCapacity(short[] array, int minCapacity)
      Ensures that a given array can hold up to minCapacity elements.
      static StringtoString(boolean[] array)
      Returns a string representation of the specified array.
      static StringtoString(byte[] array)
      Returns a string representation of the specified array.
      static StringtoString(char[] array)
      Returns a string representation of the specified array.
      static StringtoString(double[] array)
      Returns a string representation of the specified array.
      static StringtoString(float[] array)
      Returns a string representation of the specified array.
      static StringtoString(int[] array)
      Returns a string representation of the specified array.
      static StringtoString(long[] array)
      Returns a string representation of the specified array.
      static StringtoString(Object[] array)
      Returns a string representation of the specified array.
      static StringtoString(short[] array)
      Returns a string representation of the specified array.
      static boolean[]trimToCapacity(boolean[] array, int maxCapacity)
      Ensures that the specified array cannot hold more than maxCapacity elements.
      static byte[]trimToCapacity(byte[] array, int maxCapacity)
      Ensures that the specified array cannot hold more than maxCapacity elements.
      static char[]trimToCapacity(char[] array, int maxCapacity)
      Ensures that the specified array cannot hold more than maxCapacity elements.
      static double[]trimToCapacity(double[] array, int maxCapacity)
      Ensures that the specified array cannot hold more than maxCapacity elements.
      static float[]trimToCapacity(float[] array, int maxCapacity)
      Ensures that the specified array cannot hold more than maxCapacity elements.
      static int[]trimToCapacity(int[] array, int maxCapacity)
      Ensures that the specified array cannot hold more than maxCapacity elements.
      static long[]trimToCapacity(long[] array, int maxCapacity)
      Ensures that the specified array cannot hold more than maxCapacity elements.
      static Object[]trimToCapacity(Object[] array, int maxCapacity)
      Ensures that the specified array cannot hold more than maxCapacity elements.
      static short[]trimToCapacity(short[] array, int maxCapacity)
      Ensures that the specified array cannot hold more than maxCapacity elements.
    • Method Detail

      • ensureCapacity

        public static byte[] ensureCapacity(byte[] array,                    int minCapacity)
        Ensures that a given array can hold up to minCapacity elements. Returns the identical array if it can hold at least the number of elements specified. Otherwise, returns a new array with increased capacity containing the same elements, ensuring that it can hold at least the number of elements specified by the minimum capacity argument.
        Parameters:
        minCapacity - the desired minimum capacity.
      • ensureCapacity

        public static char[] ensureCapacity(char[] array,                    int minCapacity)
        Ensures that a given array can hold up to minCapacity elements. Returns the identical array if it can hold at least the number of elements specified. Otherwise, returns a new array with increased capacity containing the same elements, ensuring that it can hold at least the number of elements specified by the minimum capacity argument.
        Parameters:
        minCapacity - the desired minimum capacity.
      • ensureCapacity

        public static double[] ensureCapacity(double[] array,                      int minCapacity)
        Ensures that a given array can hold up to minCapacity elements. Returns the identical array if it can hold at least the number of elements specified. Otherwise, returns a new array with increased capacity containing the same elements, ensuring that it can hold at least the number of elements specified by the minimum capacity argument.
        Parameters:
        minCapacity - the desired minimum capacity.
      • ensureCapacity

        public static float[] ensureCapacity(float[] array,                     int minCapacity)
        Ensures that a given array can hold up to minCapacity elements. Returns the identical array if it can hold at least the number of elements specified. Otherwise, returns a new array with increased capacity containing the same elements, ensuring that it can hold at least the number of elements specified by the minimum capacity argument.
        Parameters:
        minCapacity - the desired minimum capacity.
      • ensureCapacity

        public static int[] ensureCapacity(int[] array,                   int minCapacity)
        Ensures that a given array can hold up to minCapacity elements. Returns the identical array if it can hold at least the number of elements specified. Otherwise, returns a new array with increased capacity containing the same elements, ensuring that it can hold at least the number of elements specified by the minimum capacity argument.
        Parameters:
        minCapacity - the desired minimum capacity.
      • ensureCapacity

        public static long[] ensureCapacity(long[] array,                    int minCapacity)
        Ensures that a given array can hold up to minCapacity elements. Returns the identical array if it can hold at least the number of elements specified. Otherwise, returns a new array with increased capacity containing the same elements, ensuring that it can hold at least the number of elements specified by the minimum capacity argument.
        Parameters:
        minCapacity - the desired minimum capacity.
      • ensureCapacity

        public static Object[] ensureCapacity(Object[] array,                      int minCapacity)
        Ensures that a given array can hold up to minCapacity elements. Returns the identical array if it can hold at least the number of elements specified. Otherwise, returns a new array with increased capacity containing the same elements, ensuring that it can hold at least the number of elements specified by the minimum capacity argument.
        Parameters:
        minCapacity - the desired minimum capacity.
      • ensureCapacity

        public static short[] ensureCapacity(short[] array,                     int minCapacity)
        Ensures that a given array can hold up to minCapacity elements. Returns the identical array if it can hold at least the number of elements specified. Otherwise, returns a new array with increased capacity containing the same elements, ensuring that it can hold at least the number of elements specified by the minimum capacity argument.
        Parameters:
        minCapacity - the desired minimum capacity.
      • ensureCapacity

        public static boolean[] ensureCapacity(boolean[] array,                       int minCapacity)
        Ensures that a given array can hold up to minCapacity elements. Returns the identical array if it can hold at least the number of elements specified. Otherwise, returns a new array with increased capacity containing the same elements, ensuring that it can hold at least the number of elements specified by the minimum capacity argument.
        Parameters:
        minCapacity - the desired minimum capacity.
      • toString

        public static String toString(byte[] array)
        Returns a string representation of the specified array. The string representation consists of a list of the arrays's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
        Returns:
        a string representation of the specified array.
      • toString

        public static String toString(char[] array)
        Returns a string representation of the specified array. The string representation consists of a list of the arrays's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
        Returns:
        a string representation of the specified array.
      • toString

        public static String toString(double[] array)
        Returns a string representation of the specified array. The string representation consists of a list of the arrays's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
        Returns:
        a string representation of the specified array.
      • toString

        public static String toString(float[] array)
        Returns a string representation of the specified array. The string representation consists of a list of the arrays's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
        Returns:
        a string representation of the specified array.
      • toString

        public static String toString(int[] array)
        Returns a string representation of the specified array. The string representation consists of a list of the arrays's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
        Returns:
        a string representation of the specified array.
      • toString

        public static String toString(long[] array)
        Returns a string representation of the specified array. The string representation consists of a list of the arrays's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
        Returns:
        a string representation of the specified array.
      • toString

        public static String toString(Object[] array)
        Returns a string representation of the specified array. The string representation consists of a list of the arrays's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
        Returns:
        a string representation of the specified array.
      • toString

        public static String toString(short[] array)
        Returns a string representation of the specified array. The string representation consists of a list of the arrays's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
        Returns:
        a string representation of the specified array.
      • toString

        public static String toString(boolean[] array)
        Returns a string representation of the specified array. The string representation consists of a list of the arrays's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
        Returns:
        a string representation of the specified array.
      • trimToCapacity

        public static byte[] trimToCapacity(byte[] array,                    int maxCapacity)
        Ensures that the specified array cannot hold more than maxCapacity elements. An application can use this operation to minimize array storage.

        Returns the identical array if array.length <= maxCapacity. Otherwise, returns a new array with a length of maxCapacity containing the first maxCapacity elements of array.

        Parameters:
        maxCapacity - the desired maximum capacity.
      • trimToCapacity

        public static char[] trimToCapacity(char[] array,                    int maxCapacity)
        Ensures that the specified array cannot hold more than maxCapacity elements. An application can use this operation to minimize array storage.

        Returns the identical array if array.length <= maxCapacity. Otherwise, returns a new array with a length of maxCapacity containing the first maxCapacity elements of array.

        Parameters:
        maxCapacity - the desired maximum capacity.
      • trimToCapacity

        public static double[] trimToCapacity(double[] array,                      int maxCapacity)
        Ensures that the specified array cannot hold more than maxCapacity elements. An application can use this operation to minimize array storage.

        Returns the identical array if array.length <= maxCapacity. Otherwise, returns a new array with a length of maxCapacity containing the first maxCapacity elements of array.

        Parameters:
        maxCapacity - the desired maximum capacity.
      • trimToCapacity

        public static float[] trimToCapacity(float[] array,                     int maxCapacity)
        Ensures that the specified array cannot hold more than maxCapacity elements. An application can use this operation to minimize array storage.

        Returns the identical array if array.length <= maxCapacity. Otherwise, returns a new array with a length of maxCapacity containing the first maxCapacity elements of array.

        Parameters:
        maxCapacity - the desired maximum capacity.
      • trimToCapacity

        public static int[] trimToCapacity(int[] array,                   int maxCapacity)
        Ensures that the specified array cannot hold more than maxCapacity elements. An application can use this operation to minimize array storage.

        Returns the identical array if array.length <= maxCapacity. Otherwise, returns a new array with a length of maxCapacity containing the first maxCapacity elements of array.

        Parameters:
        maxCapacity - the desired maximum capacity.
      • trimToCapacity

        public static long[] trimToCapacity(long[] array,                    int maxCapacity)
        Ensures that the specified array cannot hold more than maxCapacity elements. An application can use this operation to minimize array storage.

        Returns the identical array if array.length <= maxCapacity. Otherwise, returns a new array with a length of maxCapacity containing the first maxCapacity elements of array.

        Parameters:
        maxCapacity - the desired maximum capacity.
      • trimToCapacity

        public static Object[] trimToCapacity(Object[] array,                      int maxCapacity)
        Ensures that the specified array cannot hold more than maxCapacity elements. An application can use this operation to minimize array storage.

        Returns the identical array if array.length <= maxCapacity. Otherwise, returns a new array with a length of maxCapacity containing the first maxCapacity elements of array.

        Parameters:
        maxCapacity - the desired maximum capacity.
      • trimToCapacity

        public static short[] trimToCapacity(short[] array,                     int maxCapacity)
        Ensures that the specified array cannot hold more than maxCapacity elements. An application can use this operation to minimize array storage.

        Returns the identical array if array.length <= maxCapacity. Otherwise, returns a new array with a length of maxCapacity containing the first maxCapacity elements of array.

        Parameters:
        maxCapacity - the desired maximum capacity.
      • trimToCapacity

        public static boolean[] trimToCapacity(boolean[] array,                       int maxCapacity)
        Ensures that the specified array cannot hold more than maxCapacity elements. An application can use this operation to minimize array storage.

        Returns the identical array if array.length <= maxCapacity. Otherwise, returns a new array with a length of maxCapacity containing the first maxCapacity elements of array.

        Parameters:
        maxCapacity - the desired maximum capacity.

SCaVis 1.8 © jWork.org