Why we have Arrays and Array in Java

前端 未结 1 630
死守一世寂寞
死守一世寂寞 2021-01-01 05:35

I have run into these two documentations:

  • Java documentation for the class Array
  • Java documentation for the class Arrays

and I\'m wonde

相关标签:
1条回答
  • 2021-01-01 05:55

    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".

    0 讨论(0)
提交回复
热议问题