Overview of the Java Collections Framework Fundamentals -

The origin of a .Java Collections Framework:
In fact, before Java2 (jdk1.2), Java is not a complete collection framework. It may be only a few simple self-expanding container classes, such as Vector, Stack, Hashtable and so on.
Why are there container classes: Class container (collections) may store a plurality of data since the array may store a plurality of data, how to define a container class.
Drawbacks array:
1): length is immutable, once the initialization of the array, the length is fixed.
2): N in place need to store a plurality of data, had specifically to the preparation method of operation of the array, so since there is no reflected DRY principle.
code and repeat functions --------> package Thought .
3): the class and method names even if everyone should use the array class, but different people are different definitions, implementation details is uneven
SUN companies better define their own container classes, each developer who can just call.

Second, what is the set framework:
the collections framework is a unified standard for the representation and set of operations and the provisions of architecture. Any frame contains a set of three large content: interface, external interface algorithm and the set operations (underlying algorithm corresponds with a certain kind of data structure).

III. Why do we need a set of framework:
1): provides multiplexing functions (java.util package).
2): Let the program ape to focus on business development, rather than data structures and algorithms
to a collection of classes and interfaces that are stored in the frame java.util package

Four common collection classes:.
The Set (set of): the set of objects are not sorted in a particular manner, does not allow duplicate elements.
List (List): the collection of objects sorted by index position, allowing repeat elements.
The Map (mapping): each element in the collection contains a pair of key and value objects. Object allowed duplicate key, the value of the object may be repeated.

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Follow-up will detail each of the collections framework, a wave of concern walk.

Published 99 original articles · won praise 2 · Views 2611

Guess you like

Origin blog.csdn.net/weixin_41588751/article/details/105252307