数组;Arrays类的API

数组是对象,数组的元素是对象的成员变量

java数组本身就是对象,不论其装的是原始类型还是对象,数组都像其他对象一样储存在 中。

数组元素相当于对象的成员变量。

Arrays类API

sort

public static void sort(int[] a)

Sorts the specified array into ascending numerical order.

将数组a升序排序。

Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.

排序算法是双轴快速排序,在使得其他快速排序降为二次性能的许多数据集上提供O(n log(n)) 表现,且通常比传统(单轴)快速排序实现更快。

parallelSort

并行排序,完成和sort相同的功能,属于并行算法,要用到一个叫做ForkJoinPool的类。

copyOf

从某下标开始取数组一定长度的副本成为新数组

equals

判断数组相等

fill

把数组中指定范围用指定元素填充

toString

Arrays.toString把数组所有元素用逗号分隔、中括号包住、输出而不是sout输出的getClass().getName() + "@" + Integer.toHexString(hashCode())

posted @ 2021-01-31 23:33  口合口合kouhekouhe  阅读(70)  评论(0编辑  收藏  举报