Java Arrays Class Methods

The java.util.Arrays class contains various methods for manipulating arrays (such as sorting and searching).

Java Arrays Methods

The table below contains various methods of the java.util.Arrays class, each with a link to a detailed explanation, examples, and real-world uses. Click on the method names to learn more about how to use them effectively in your applications.
Method Description
Arrays asList() Method in Java Converts an array to a fixed-size list.
Arrays binarySearch() Method in Java Searches the specified array for the specified value using the binary search algorithm.
Arrays compare() Method in Java Compares two arrays lexicographically.
Arrays copyOf() Method in Java Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length.
Arrays copyOfRange() Method in Java Copies the specified range of the specified array into a new array.
Arrays deepEquals() Method in Java Returns true if the two specified arrays are deeply equal to one another.
Arrays equals() Method in Java Returns true if the two specified arrays are equal to one another.
Arrays fill() Method in Java Assigns the specified value to each element of the specified array.
Arrays mismatch() Method in Java Finds and returns the index of the first mismatch between two arrays, otherwise returns -1 if no mismatch is found.
Arrays parallelSort() Method in Java Sorts the specified array into ascending numerical order using parallel sorting.
Arrays setAll() Method in Java Sets all elements of the specified array, using the provided generator function to compute each element.
Arrays sort() Method in Java Sorts the specified array into ascending order.
Arrays spliterator() Method in Java Creates a Spliterator over the elements in the specified array.
Arrays stream() Method in Java Returns a sequential stream with the specified array as its source.
Arrays toString() Method in Java Returns a string representation of the contents of the specified array.

For more details, visit the Java API Documentation.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top