Java Handy notes eight set generics

Source: Internet
Author: User

Object: Root Class
Tostring,equals,hashcode
Package Type: 8, Integer,character
XXX parsexxx (), Auto boxing (new Xxx ()) and automatic unpacking (intvalue ())
String class:
String:final class, non-changing unicode, Returning a new string object
The stringbuffer,stringbuilder:final class, which can change the unicode, returns the original buffer of the string object
Math Class:
Math: Static
Constants and methods

Collection:
Store different types of objects, variable length
Arrays: storing data of the same type, fixed length

Collection: storing unordered and repeatable elements
---List: Elements repeat, ordered
---ArrayList
---linkedlist
---Set: element Repetition is not allowed, unordered
---HashSet
---SortedSet
---TreeSet

Generics: jdk1.5, which can be considered a security mechanism,
representation:< element type > Once a generic is used, it is equivalent to adding a constraint to the collection,
The collection can only store the type of elements specified by the generic type
The generic type parameter does not support polymorphism
?: wildcard character, can represent any type
? Extends E: Receives the subtype of type E and its e----upper limit
? Super E: Receives the parent type of type E and its e----lower bound

HashSet: the underlying data structure is: hash algorithm.
Each object to be stored computes the hash code value (the hashcode method), and if the hash value is different, it is deposited into the Collection.
If the hash value is the same, the second check is made by the equals method, and the comparison is whether the same object
TreeSet: the underlying data structure Is: two fork tree, which sorts the elements in natural order
When storing a custom object, you must implement the comparable interface and implement the CompareTo method of the interface
Based on the return value of the method, the natural order is sorted,
The return value is a positive integer, a negative integer, 0, if 0 means the same element.
ArrayList: the underlying data structure is: array
Element continuous, Find and modify fast, Delete and add slow
Linkedlist: the data structure of the city Is: doubly linked list
Elements can be discontinuous, find and modify slowly, Add and delete fast

Iterators:
---retrieve the elements of the collection,---called an iteration
Iterator Iterator ()
Listiterator Listiterator ()

Java Handy notes eight set generics

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.