java-Base (quad) Aarryas array

Source: Internet
Author: User
Tags comparable sorts

1. Aslist () method

Returns a list that is supported by the specified array. In other words, lists and arrays access the same unit. It has the following form: Static List aslist (object[] array)

2.binarySearch ()

Method searches for the specified value using binary search. The method must be applied to the sorted array. It has the following form:

static int BinarySearch (byte[] array, byte value)

static int BinarySearch (char[] array, char value)

static int BinarySearch (double[] array, double value)

static int BinarySearch (float[] array, float value)

static int BinarySearch (int[] array, int value)

static int BinarySearch (long[] array, Long value)

static int BinarySearch (short[] array, short value)

static int BinarySearch (object[] array, Object value)

static int BinarySearch (object[] array, Object value, Comparator c)

Here, the array is the one being searched, and value is the one being looked up. When an array contains elements that are not comparable (for example, double and stringbuffer) or when value is incompatible with the type in the array, the latter two forms throw a classcastexception exception. In the last form, the comparison function (Comparator) c is used to determine the order of the elements in the array. In all forms, if the array contains value, the index of the element is returned. Otherwise, a negative value is returned.

3. The Equals () method returns true; otherwise returns false

The 4.fill () method assigns a value to all elements in the array

The 5.sort () method sorts the array so that the arrays can be arranged in ascending order

static void sort (Object array[], Comparator c) Here, the array is sorted. In the final form, C is a comparison function (Comparator) that specifies the order of elements in an array. When the elements in the array used for sorting are not comparable, the sort () method that sorts the array of objects throws a ClassCastException exception.

Sort the partial sorting

static void sort (Object array[], int start, int end, Comparator c)

java-Base (quad) Aarryas array

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.