4

I have run into these two documentations:

and I'm wondering what the difference is between these two classes. They both provide a different set of static methods, but why are they separate? What is the deeper difference? And what is the relation between them and with the normal instance of array like int[].

I notice that they are from totally different packages, but still hope to find some clarification. Thanks.

2
  • Arrays it is a utility class which provides additional functionality to make it easier to work with arrays, performing (some) common functionality. Array is a representation of a instance of an array, through which you can access some of it's properties and is used to support the reflections API. They are basically doing different things for different purposes. Arrays can work with different instances of arrays Commented Mar 3, 2016 at 0:31
  • Excuse me but if you've 'run into the documentation' why haven't you read it? Commented Mar 3, 2016 at 0:47

1 Answer 1

14

The differences are made fairly clear in the docs.

From Arrays.java:

This class contains various methods for manipulating arrays (such as sorting and searching). This class also contains a static factory that allows arrays to be viewed as lists.

From Array.java

The Array class provides static methods to dynamically create and access Java arrays.

Essentialy Array is an implementation of core Array operations - getting, setting and instantiation.

Arrays is a helper class for wrapping common Array operations (conversion between Arrays and Lists, sorting, searching for a value) without polluting the core Array "api".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.