Java record-34-Arrays class Parsing
Java. util class Arrayspublic class Arrays extends Object contains various methods used to operate Arrays (such as sorting and searching. This class also contains a static factory that allows you to view arrays as a list. All methods provided by the Arrays class are static methods. You can use the class name directly. Arrays are the most efficient way to save a group of objects. To save basic types, you can only use arrays. The Arrays class provides the following functional methods: 1. assign values to Arrays: Use the fill method. 2. sort Arrays: sort arrays in ascending order using the sort method. 3. Comparison array: Use the equals method to compare whether the element values in the array are equal. 4. Search for array elements: binarySearch can be used to perform binary search for sorted arrays. Note: 1. Methods of the Arrays class. Except for some methods that do not support boolean Arrays, all data types are supported. 2. The deepEquals () method is actually a recursive algorithm of the Equals () method, and the deepToString () method is a recursion of toString. 3. Use the corresponding sort method to sort data before searching. For example, the third method specifies that the sort (T [], Comparator) method must be used before the Comparator search. 4. Java generally uses the following inclusion method when specifying a range, that is, the first index that includes the range, excluding the last index of the range. The range of methods such as fill () is fromIndex (the first index, including), toIndex (the last index, not including), and from (the first index, including), to (tail index, not including) 5, fill (), sort (), binarySearch () when the specified range, if fromIndex = toIndex, the range is null, if the length exceeds the array length or fromIndex> toIndex, an exception is thrown.
Next article: http://www.bkjia.com/kf/201510/447454.html