public class Arrays extends Object
Constructor and Description |
---|
Arrays() |
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
asList(T... array) |
static int |
binarySearch(byte[] sortedArray,
byte key)
Perform a binary search on a sorted byte array.
|
static int |
binarySearch(char[] a,
char key)
Perform a binary search on a sorted char array.
|
static int |
binarySearch(double[] sortedArray,
double key)
Perform a binary search on a sorted double array.
|
static int |
binarySearch(float[] sortedArray,
float key)
Perform a binary search on a sorted float array.
|
static int |
binarySearch(int[] sortedArray,
int key)
Perform a binary search on a sorted int array.
|
static int |
binarySearch(long[] sortedArray,
long key)
Perform a binary search on a sorted long array.
|
static int |
binarySearch(Object[] sortedArray,
Object key)
Perform a binary search on a sorted object array, using natural ordering.
|
static int |
binarySearch(short[] sortedArray,
short key)
Perform a binary search on a sorted short array.
|
static <T> int |
binarySearch(T[] sortedArray,
T key,
Comparator<? super T> comparator)
Perform a binary search on a sorted object array, using a user-specified
comparison function.
|
static boolean[] |
copyOf(boolean[] original,
int newLength) |
static byte[] |
copyOf(byte[] original,
int newLength) |
static char[] |
copyOf(char[] original,
int newLength) |
static double[] |
copyOf(double[] original,
int newLength) |
static float[] |
copyOf(float[] original,
int newLength) |
static int[] |
copyOf(int[] original,
int newLength) |
static long[] |
copyOf(long[] original,
int newLength) |
static short[] |
copyOf(short[] original,
int newLength) |
static <T> T[] |
copyOf(T[] original,
int newLength) |
static boolean[] |
copyOfRange(boolean[] original,
int from,
int to) |
static byte[] |
copyOfRange(byte[] original,
int from,
int to) |
static char[] |
copyOfRange(char[] original,
int from,
int to) |
static double[] |
copyOfRange(double[] original,
int from,
int to) |
static float[] |
copyOfRange(float[] original,
int from,
int to) |
static int[] |
copyOfRange(int[] original,
int from,
int to) |
static long[] |
copyOfRange(long[] original,
int from,
int to) |
static short[] |
copyOfRange(short[] original,
int from,
int to) |
static <T> T[] |
copyOfRange(T[] original,
int from,
int to) |
static boolean |
deepEquals(Object[] a1,
Object[] a2) |
static int |
deepHashCode(Object[] a) |
static String |
deepToString(Object[] a) |
static boolean |
equals(boolean[] array1,
boolean[] array2) |
static boolean |
equals(byte[] array1,
byte[] array2) |
static boolean |
equals(char[] array1,
char[] array2) |
static boolean |
equals(double[] array1,
double[] array2) |
static boolean |
equals(float[] array1,
float[] array2) |
static boolean |
equals(int[] array1,
int[] array2) |
static boolean |
equals(long[] array1,
long[] array2) |
static boolean |
equals(Object[] array1,
Object[] array2) |
static boolean |
equals(short[] array1,
short[] array2) |
static void |
fill(boolean[] a,
boolean val) |
static void |
fill(boolean[] a,
int fromIndex,
int toIndex,
boolean val) |
static void |
fill(byte[] a,
byte val) |
static void |
fill(byte[] a,
int fromIndex,
int toIndex,
byte val) |
static void |
fill(char[] a,
char val) |
static void |
fill(char[] a,
int fromIndex,
int toIndex,
char val) |
static void |
fill(double[] a,
double val) |
static void |
fill(double[] a,
int fromIndex,
int toIndex,
double val) |
static void |
fill(float[] a,
float val) |
static void |
fill(float[] a,
int fromIndex,
int toIndex,
float val) |
static void |
fill(int[] a,
int val) |
static void |
fill(int[] a,
int fromIndex,
int toIndex,
int val) |
static void |
fill(long[] a,
int fromIndex,
int toIndex,
long val) |
static void |
fill(long[] a,
long val) |
static void |
fill(Object[] a,
int fromIndex,
int toIndex,
Object val) |
static void |
fill(Object[] a,
Object val) |
static void |
fill(short[] a,
int fromIndex,
int toIndex,
short val) |
static void |
fill(short[] a,
short val) |
static int |
hashCode(boolean[] a) |
static int |
hashCode(byte[] a) |
static int |
hashCode(char[] a) |
static int |
hashCode(double[] a) |
static int |
hashCode(float[] a) |
static int |
hashCode(int[] a) |
static int |
hashCode(long[] a) |
static int |
hashCode(Object[] a) |
static int |
hashCode(short[] a) |
static void |
sort(byte[] array) |
static void |
sort(byte[] array,
int fromIndex,
int toIndex) |
static void |
sort(char[] array) |
static void |
sort(char[] array,
int fromIndex,
int toIndex) |
static void |
sort(double[] array) |
static void |
sort(double[] array,
int fromIndex,
int toIndex) |
static void |
sort(float[] array) |
static void |
sort(float[] array,
int fromIndex,
int toIndex) |
static void |
sort(int[] array) |
static void |
sort(int[] array,
int fromIndex,
int toIndex) |
static void |
sort(long[] array) |
static void |
sort(long[] array,
int fromIndex,
int toIndex) |
static void |
sort(Object[] array) |
static void |
sort(Object[] x,
int fromIndex,
int toIndex) |
static void |
sort(short[] array) |
static void |
sort(short[] array,
int fromIndex,
int toIndex) |
static <T> void |
sort(T[] x,
Comparator<? super T> c) |
static <T> void |
sort(T[] x,
int fromIndex,
int toIndex,
Comparator<? super T> c) |
static String |
toString(boolean[] a) |
static String |
toString(byte[] a) |
static String |
toString(char[] a) |
static String |
toString(double[] a) |
static String |
toString(float[] a) |
static String |
toString(int[] a) |
static String |
toString(long[] a) |
static String |
toString(Object[] x) |
static String |
toString(short[] a) |
public static <T> List<T> asList(T... array)
public static int binarySearch(byte[] sortedArray, byte key)
sortedArray
- byte array to searchkey
- value to search forpublic static int binarySearch(char[] a, char key)
a
- char array to searchkey
- value to search forpublic static int binarySearch(double[] sortedArray, double key)
sortedArray
- double array to searchkey
- value to search forpublic static int binarySearch(float[] sortedArray, float key)
sortedArray
- float array to searchkey
- value to search forpublic static int binarySearch(int[] sortedArray, int key)
sortedArray
- int array to searchkey
- value to search forpublic static int binarySearch(long[] sortedArray, long key)
sortedArray
- long array to searchkey
- value to search forpublic static int binarySearch(Object[] sortedArray, Object key)
sortedArray
- object array to searchkey
- value to search forClassCastException
- if key
is not comparable to
sortedArray
's elements.public static int binarySearch(short[] sortedArray, short key)
sortedArray
- short array to searchkey
- value to search forpublic static <T> int binarySearch(T[] sortedArray, T key, Comparator<? super T> comparator)
sortedArray
- object array to searchkey
- value to search forcomparator
- comparision function, null
indicates
natural ordering should be used.ClassCastException
- if key
and
sortedArray
's elements cannot be compared by
comparator
.public static boolean[] copyOf(boolean[] original, int newLength)
public static byte[] copyOf(byte[] original, int newLength)
public static char[] copyOf(char[] original, int newLength)
public static double[] copyOf(double[] original, int newLength)
public static float[] copyOf(float[] original, int newLength)
public static int[] copyOf(int[] original, int newLength)
public static long[] copyOf(long[] original, int newLength)
public static short[] copyOf(short[] original, int newLength)
public static <T> T[] copyOf(T[] original, int newLength)
public static boolean[] copyOfRange(boolean[] original, int from, int to)
public static byte[] copyOfRange(byte[] original, int from, int to)
public static char[] copyOfRange(char[] original, int from, int to)
public static double[] copyOfRange(double[] original, int from, int to)
public static float[] copyOfRange(float[] original, int from, int to)
public static int[] copyOfRange(int[] original, int from, int to)
public static long[] copyOfRange(long[] original, int from, int to)
public static short[] copyOfRange(short[] original, int from, int to)
public static <T> T[] copyOfRange(T[] original, int from, int to)
public static int deepHashCode(Object[] a)
public static boolean equals(boolean[] array1, boolean[] array2)
public static boolean equals(byte[] array1, byte[] array2)
public static boolean equals(char[] array1, char[] array2)
public static boolean equals(double[] array1, double[] array2)
public static boolean equals(float[] array1, float[] array2)
public static boolean equals(int[] array1, int[] array2)
public static boolean equals(long[] array1, long[] array2)
public static boolean equals(short[] array1, short[] array2)
public static void fill(boolean[] a, boolean val)
public static void fill(boolean[] a, int fromIndex, int toIndex, boolean val)
public static void fill(byte[] a, byte val)
public static void fill(byte[] a, int fromIndex, int toIndex, byte val)
public static void fill(char[] a, char val)
public static void fill(char[] a, int fromIndex, int toIndex, char val)
public static void fill(double[] a, double val)
public static void fill(double[] a, int fromIndex, int toIndex, double val)
public static void fill(float[] a, float val)
public static void fill(float[] a, int fromIndex, int toIndex, float val)
public static void fill(int[] a, int val)
public static void fill(int[] a, int fromIndex, int toIndex, int val)
public static void fill(long[] a, int fromIndex, int toIndex, long val)
public static void fill(long[] a, long val)
public static void fill(short[] a, int fromIndex, int toIndex, short val)
public static void fill(short[] a, short val)
public static int hashCode(boolean[] a)
public static int hashCode(byte[] a)
public static int hashCode(char[] a)
public static int hashCode(double[] a)
public static int hashCode(float[] a)
public static int hashCode(int[] a)
public static int hashCode(long[] a)
public static int hashCode(Object[] a)
public static int hashCode(short[] a)
public static void sort(byte[] array)
public static void sort(byte[] array, int fromIndex, int toIndex)
public static void sort(char[] array)
public static void sort(char[] array, int fromIndex, int toIndex)
public static void sort(double[] array)
public static void sort(double[] array, int fromIndex, int toIndex)
public static void sort(float[] array)
public static void sort(float[] array, int fromIndex, int toIndex)
public static void sort(int[] array)
public static void sort(int[] array, int fromIndex, int toIndex)
public static void sort(long[] array)
public static void sort(long[] array, int fromIndex, int toIndex)
public static void sort(Object[] array)
public static void sort(Object[] x, int fromIndex, int toIndex)
public static void sort(short[] array)
public static void sort(short[] array, int fromIndex, int toIndex)
public static <T> void sort(T[] x, Comparator<? super T> c)
public static <T> void sort(T[] x, int fromIndex, int toIndex, Comparator<? super T> c)
public static String toString(boolean[] a)
public static String toString(byte[] a)
public static String toString(char[] a)
public static String toString(double[] a)
public static String toString(float[] a)
public static String toString(int[] a)
public static String toString(long[] a)
public static String toString(short[] a)
Copyright © 2018. All rights reserved.