Java JavaScript Python C# C C++ Go Kotlin PHP Swift R Ruby TypeScript Scala SQL Perl rust VisualBasic Matlab Julia

Array methods

java.util.array

All Java methods in java.util.Arrays class

"The java.util.Arrays class in Java is a part of the Java Collection Framework and holds static methods for specifically handling arrays. It provides numerous methods for manipulating arrays (such as sorting and searching) and also for viewing arrays as lists. Here are some of the key methods provided by the java.util.Arrays class: asList(): This method returns a fixed-size list backed by the specified array. Changes to the returned list ""write through"" to the array. sort(): This method sorts the specified array into ascending numerical order. binarySearch(): This method searches the specified array for the specified object using the binary search algorithm. equals(): This method returns true if the two specified arrays are equal to one another. fill(): This method assigns the specified data type value to each element of the specified range of the specified array. deepToString(): This method returns a string representation of the “deep contents” of the specified array. copyOf() and copyOfRange(): These methods copy the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. deepEquals(): This method returns true if the two specified arrays are deeply equal to one another. Unlike the equals() method, this method is designed for use with nested arrays of arbitrary depth. deepHashCode(): This method returns a hash code based on the ""deep contents"" of the specified array. For array whose elements are themselves arrays, this method will include their contents and so on, recursively. hashCode(): This method returns a hash code based on the contents of the specified array. For any two arrays `a` and `b`, if `Arrays.equals(a, b)`, then `Arrays.hashCode(a)` would be equal to `Arrays.hashCode(b)`. parallelPrefix(): This method cumulatively applies a given function to each element of the array in parallel, producing an array with the same size but with each element that is the result of applying the function to all previous elements. parallelSetAll(): This method sets all elements of the specified array, using the provided generator function to compute each element in parallel. parallelSort(): This method sorts the specified array into ascending numerical order using parallel sort-merge that breaks the array into sub-arrays that are themselves sorted and then merged. setAll(): This method sets all elements of the specified array, using the provided generator function to compute each element. stream(): This method returns a sequential stream with the specified array as its source. spliterator(): This method creates a spliterator covering all of the specified array. toString(): This method returns a string representation of the contents of the specified array. If the array contains other arrays as elements, they are converted to strings by the `Object.toString()` method inherited from `Object`, which describes their identities rather than their contents. These methods provide a lot of functionality for manipulating arrays and can be very useful in many scenarios. However, remember that they are all static methods, so you can call them directly from the class, like `Arrays.asList(yourArray)`, without creating an instance of the class."

List of all Methods in java.util.Arrays

asList(T... a)
binarySearch(byte[] a, byte key)
binarySearch(byte[] a, int fromIndex, int toIndex, byte key)
binarySearch(char[] a, char key)
binarySearch(char[] a, int fromIndex, int toIndex, char key)
binarySearch(double[] a, double key)
binarySearch(double[] a, int fromIndex, int toIndex, double key)
binarySearch(float[] a, float key)
binarySearch(float[] a, int fromIndex, int toIndex, float key)
binarySearch(int[] a, int key)
binarySearch(int[] a, int fromIndex, int toIndex, int key)
binarySearch(long[] a, int fromIndex, int toIndex, long key)
binarySearch(long[] a, long key)
binarySearch(Object[] a, int fromIndex, int toIndex, Object key)
binarySearch(Object[] a, Object key)
binarySearch(short[] a, int fromIndex, int toIndex, short key)
binarySearch(short[] a, short key)
binarySearch(T[] a, int fromIndex, int toIndex, T key, Comparator c)
binarySearch(T[] a, T key, Comparator c)
copyOf(boolean[] original, int newLength)
copyOf(byte[] original, int newLength)
copyOf(char[] original, int newLength)
copyOf(double[] original, int newLength)
copyOf(float[] original, int newLength)
copyOf(int[] original, int newLength)
copyOf(long[] original, int newLength)
copyOf(short[] original, int newLength)
copyOf(T[] original, int newLength)
copyOf(U[] original, int newLength, Class newType)
copyOfRange(boolean[] original, int from, int to)
copyOfRange(byte[] original, int from, int to)
copyOfRange(char[] original, int from, int to)
copyOfRange(double[] original, int from, int to)
copyOfRange(float[] original, int from, int to)
copyOfRange(int[] original, int from, int to)
copyOfRange(long[] original, int from, int to)
copyOfRange(short[] original, int from, int to)
copyOfRange(T[] original, int from, int to)
copyOfRange(U[] original, int from, int to, Class newType)
deepEquals(Object[] a1, Object[] a2)
deepHashCode(Object[] a)
deepToString(Object[] a)
equals(boolean[] a, boolean[] a2)
equals(byte[] a, byte[] a2)
equals(char[] a, char[] a2)
equals(double[] a, double[] a2)
equals(float[] a, float[] a2)
equals(int[] a, int[] a2)
equals(long[] a, long[] a2)
equals(Object[] a, Object[] a2)
equals(short[] a, short[] a2)
fill(boolean[] a, boolean val)
fill(boolean[] a, int fromIndex, int toIndex, boolean val)
fill(byte[] a, byte val)
fill(byte[] a, int fromIndex, int toIndex, byte val)
fill(char[] a, char val)
fill(char[] a, int fromIndex, int toIndex, char val)
fill(double[] a, double val)
fill(double[] a, int fromIndex, int toIndex, double val)
fill(float[] a, float val)
fill(float[] a, int fromIndex, int toIndex, float val)
fill(int[] a, int val)
fill(int[] a, int fromIndex, int toIndex, int val)
fill(long[] a, int fromIndex, int toIndex, long val)
fill(long[] a, long val)
fill(Object[] a, int fromIndex, int toIndex, Object val)
fill(Object[] a, Object val)
fill(short[] a, int fromIndex, int toIndex, short val)
fill(short[] a, short val)
hashCode(boolean[] a)
hashCode(byte[] a)
hashCode(char[] a)
hashCode(double[] a)
hashCode(float[] a)
hashCode(int[] a)
hashCode(long[] a)
hashCode(Object[] a)
hashCode(short[] a)
parallelPrefix(double[] array, DoubleBinaryOperator op)
parallelPrefix(double[] array, int fromIndex, int toIndex, DoubleBinaryOperator op)
parallelPrefix(int[] array, IntBinaryOperator op)
parallelPrefix(int[] array, int fromIndex, int toIndex, IntBinaryOperator op)
parallelPrefix(long[] array, int fromIndex, int toIndex, LongBinaryOperator op)
parallelPrefix(long[] array, LongBinaryOperator op)
parallelPrefix(T[] array, BinaryOperator op)
parallelPrefix(T[] array, int fromIndex, int toIndex, BinaryOperator op)
parallelSetAll(double[] array, IntToDoubleFunction generator)
parallelSetAll(int[] array, IntUnaryOperator generator)
parallelSetAll(long[] array, IntToLongFunction generator)
parallelSetAll(T[] array, IntFunction generator)
parallelSort(byte[] a)
parallelSort(byte[] a, int fromIndex, int toIndex)
parallelSort(char[] a)
parallelSort(char[] a, int fromIndex, int toIndex)
parallelSort(double[] a)
parallelSort(double[] a, int fromIndex, int toIndex)
parallelSort(float[] a)
parallelSort(float[] a, int fromIndex, int toIndex)
parallelSort(int[] a)
parallelSort(int[] a, int fromIndex, int toIndex)
parallelSort(long[] a)
parallelSort(long[] a, int fromIndex, int toIndex)
parallelSort(short[] a)
parallelSort(short[] a, int fromIndex, int toIndex)
parallelSort(T[] a)
parallelSort(T[] a, Comparator cmp)
parallelSort(T[] a, int fromIndex, int toIndex)
parallelSort(T[] a, int fromIndex, int toIndex, Comparator cmp)
setAll(double[] array, IntToDoubleFunction generator)
setAll(int[] array, IntUnaryOperator generator)
setAll(long[] array, IntToLongFunction generator)
setAll(T[] array, IntFunction generator)
sort(byte[] a)
sort(byte[] a, int fromIndex, int toIndex)
sort(char[] a)
sort(char[] a, int fromIndex, int toIndex)
sort(double[] a)
sort(double[] a, int fromIndex, int toIndex)
sort(float[] a)
sort(float[] a, int fromIndex, int toIndex)
sort(int[] a)
sort(int[] a, int fromIndex, int toIndex)
sort(long[] a)
sort(long[] a, int fromIndex, int toIndex)
sort(Object[] a)
sort(Object[] a, int fromIndex, int toIndex)
sort(short[] a)
sort(short[] a, int fromIndex, int toIndex)
sort(T[] a, Comparator c)
sort(T[] a, int fromIndex, int toIndex, Comparator c)
spliterator(double[] array)
spliterator(double[] array, int startInclusive, int endExclusive)
spliterator(int[] array)
spliterator(int[] array, int startInclusive, int endExclusive)
spliterator(long[] array)
spliterator(long[] array, int startInclusive, int endExclusive)
spliterator(T[] array)
spliterator(T[] array, int startInclusive, int endExclusive)
stream(double[] array)
stream(double[] array, int startInclusive, int endExclusive)
stream(int[] array)
stream(int[] array, int startInclusive, int endExclusive)
stream(long[] array)
stream(long[] array, int startInclusive, int endExclusive)
stream(T[] array)
stream(T[] array, int startInclusive, int endExclusive)
toString(boolean[] a)
toString(byte[] a)
toString(char[] a)
toString(double[] a)
toString(float[] a)
toString(int[] a)
toString(long[] a)
toString(Object[] a)
toString(short[] a)

  📌TAGS

★array ★methods ★class ★package ★java.util.arrays

Tutorials