Java Collection Framework tool class collections, operation of the collection

Source: Internet
Author: User

1

Import java.util.*; Public classaslist{ Public Static voidMain (String args[]) {//int arr[] = {1,2,3,4,45}; //list<int[]> List = arrays.aslist (arr); //List.add ("QQ"); Cannot be added here, because the length of the array is fixed//integer[] nums = {2,4,5,2}; //list<integer> li = arrays.aslist (nums); //if the element in the array is an object, then the elements in the array go directly to the elements in the collection when they become collections//if the element in the array is the base data type, the array will be present as an element in the collection.String arr[]= {"ABC","cc","KKK"}; List<String> list =arrays.aslist (arr); List.contains ("cc"); }     Public Staticboolean mycontains (string[] arr,string key) { for(intx=0; x<arr.length;x++)        {            if(Arr[x].equals (key))return true; }        return false; }}

Java Collection Framework tool class collections, operation of the collection

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.