Collections Overview
Set: set java is a container provided can be used to store a plurality of data.
Since collections and arrays are containers, they are so what difference does it make?
- Length of the array is fixed. The collection length is variable.
- Stored in the array element of the same type, you can store basic data type value. Collection of objects are stored. And the type of the object can be inconsistent. When the object is generally more time, use the collection is stored in development.
Collections Framework
In accordance with its set of storage structure can be divided into two categories,
- A separate set of java.util.Collection
- Double set of columns java.util.Map
Collection: single root interface collection classes, the collection itself is a tool, it is stored in the java.util package. In the interface definition Collection single most common set of frame content. For storing a series of elements that meet certain rules, it has two important sub-interfaces, respectively,
- java.util.List: characterized by the orderly elements, the elements can be repeated.
- java.util.Set: characterized by an element of disorder, and can not be repeated.
List the main interface implementation class has a `
- java.util.ArrayList
- java.util.LinkedList
The main class that implements the Set interface have
- Jawakutilkःashset
- java.util.TreeSet