Java Collection Data Structure
(Redirected from Java Collection)
Jump to navigation
Jump to search
A Java Collection Data Structure is a collection data structure in the Java programming language.
- Context:
- It can be in a superclass relation with other Data Structures (http://upload.wikimedia.org/wikipedia/commons/4/41/Collection_Classes.jpg)
- It can range from being a Java Set Collection to being a Java List Collection to being a Java Queue Collection.
- It can be accessed by a Java Iterator.
- It can be accessed by a Java for-each Operator.
- Example(s):
- a Java Array.
- a Java Associative Array.
- a Java-based Stack.
List<String> list = new ArrayList<String>(c);
List<BigDecimal> vals = new ArrayList<BigDecimal>();
- Counter-Example(s):
- See: Java Collection Iterator.
References
2011
- http://en.wikipedia.org/wiki/Java_collections_framework
- QUOTE:The Java collections framework (JCF) is a set of classes and interfaces that implement commonly reusable collection data structures. Although it is a framework, it works in a manner of a library. The JCF provides both interfaces that define various collections and classes that implement them.
2010
- http://download.oracle.com/javase/tutorial/collections/intro/index.html
- QUOTE:A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data. Typically, they represent data items that form a natural group, such as a poker hand (a collection of cards), a mail folder (a collection of letters), or a telephone directory (a mapping of names to phone numbers).
If you've used the Java programming language — or just about any other programming language — you're already familiar with collections. Collection implementations in earlier (pre-1.2) versions of the Java platform included Vector, Hashtable, and array. However, those earlier versions did not contain a collections framework.
- QUOTE:A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data. Typically, they represent data items that form a natural group, such as a poker hand (a collection of cards), a mail folder (a collection of letters), or a telephone directory (a mapping of names to phone numbers).
- http://docs.oracle.com/javase/tutorial/collections/interfaces/collection.html
- QUOTE:A Collection represents a group of objects known as its elements. The Collection interface is used to pass around collections of objects where maximum generality is desired. For example, by convention all general-purpose collection implementations have a constructor that takes a Collection argument. This constructor, known as a conversion constructor, initializes the new collection to contain all of the elements in the specified collection, whatever the given collection's subinterface or implementation type. In other words, it allows you to convert the collection's type.
Suppose, for example, that you have a Collection<String> c, which may be a List, a Set, or another kind of Collection. This idiom creates a new ArrayList (an implementation of the List interface), initially containing all the elements in c.
List<String> list = new ArrayList<String>(c);
- QUOTE:A Collection represents a group of objects known as its elements. The Collection interface is used to pass around collections of objects where maximum generality is desired. For example, by convention all general-purpose collection implementations have a constructor that takes a Collection argument. This constructor, known as a conversion constructor, initializes the new collection to contain all of the elements in the specified collection, whatever the given collection's subinterface or implementation type. In other words, it allows you to convert the collection's type.