Java-class set framework (1) (41st sets)

Source: Internet
Author: User

The following is a java4android video tutorial from marschen.

Java class set framework.
JDK designers are pleased with this.
A group of classes and interfaces that are frequently used.

1. What is a class set framework?
2. Types of Sets
3. Basic Structure of the class set framework.

What is a class set framework?
1. The framework of a class set is a set of classes and interfaces.
2. It is located in the Java. util package.
3. primary users store and manage objects.
4. Mainly divided into three categories-set, list and ing.


What is a set)
Objects in the set are not sorted in a specific way and there are no repeated objects.

What is list)
Objects in the collection are sorted by index position. Duplicate objects may exist.

What is map)
Each element in the set contains a key object and a value object.
The key cannot be repeated, and the value can be repeated.


The main structure of the class set framework.
Two top-level interfaces
Iterator collection

The following example is used:

import java.util.List;import java.util.ArrayList;public class Test{public static void main(String args[]){ArrayList<String> arrayList = new ArrayList<String>();//ArrayList<Student> arrayList = new ArrayList<Student>();arrayList.add("ab");arrayList.add("2b");arrayList.add("c3");arrayList.add("43");arrayList.remove(1);//String s = arrayList.get(1);//System.out.println(s);//int a = arrayList.size();for(int i = 0; i < arrayList.size();i++){String s = arrayList.get(i);System.out.println(s);}}}


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.