![]() The collections framework defines several algorithms that can be applied to collections and maps. This array can increase in size as needed. It is used to maintain lists of values in which the key is a String and the value is also a String.Ī BitSet class creates a special type of array that holds bit values. Hashtable was part of the original java.util and is a concrete implementation of a Dictionary. Stack is a subclass of Vector that implements a standard last-in, first-out stack.ĭictionary is an abstract class that represents a key/value storage repository and operates much like Map. It is similar to ArrayList, but with some differences. The following legacy classes defined by java.util have been discussed in the previous chapter − Sr.No. The AbstractCollection, AbstractSet, AbstractList, AbstractSequentialList and AbstractMap classes provide skeletal implementations of the core collection interfaces, to minimize the effort required to implement them. Extends AbstractSet.Įxtends AbstractMap to use a hash table with weak keys.Įxtends HashMap to allow insertion-order iterations.Įxtends AbstractMap and uses reference equality when comparing documents. Implements a dynamic array by extending AbstractList.Įxtends AbstractCollection and implements most of the Set interface.Įxtends AbstractSet for use with a hash table.Įxtends HashSet to allow insertion-order iterations. Implements a linked list by extending AbstractSequentialList. Implements most of the Collection interface.Įxtends AbstractCollection and implements most of the List interface.Įxtends AbstractList for use by a collection that uses sequential rather than random access of its elements. The standard collection classes are summarized in the following table − Sr.No. Java collections in detail full#Some of the classes provide full implementations that can be used as-is and others are abstract class, providing skeletal implementations that are used as starting points for creating concrete collections. Java provides a set of standard collection classes that implement Collection interfaces. This legacy interface has been superceded by Iterator. This is legacy interface defines the methods by which you can enumerate (obtain one at a time) the elements in a collection of objects. This extends Map so that the keys are maintained in an ascending order. This describes an element (a key/value pair) in a map. ![]() This extends Collection to handle sets, which must contain unique elements. This extends Collection and an instance of List stores an ordered collection of elements. This enables you to work with groups of objects it is at the top of the collections hierarchy. This section provides an overview of each interface − Sr.No. The collections framework defines several interfaces. Although maps are not collections in the proper use of the term, but they are fully integrated with collections. ![]() In addition to collections, the framework defines several map interfaces and classes. The algorithms are said to be polymorphic: that is, the same method can be used on many different implementations of the appropriate collection interface. In essence, they are reusable data structures.Īlgorithms − These are the methods that perform useful computations, such as searching and sorting, on objects that implement collection interfaces. Implementations, i.e., Classes − These are the concrete implementations of the collection interfaces. In object-oriented languages, interfaces generally form a hierarchy. Interfaces allow collections to be manipulated independently of the details of their representation. Interfaces − These are abstract data types that represent collections. All collections frameworks contain the following − Several standard implementations such as LinkedList, HashSet, and TreeSet, of these interfaces are provided that you may use as-is and you may also implement your own collection, if you choose.Ī collections framework is a unified architecture for representing and manipulating collections. Towards this end, the entire collections framework is designed around a set of standard interfaces. The framework had to extend and/or adapt a collection easily. The framework had to allow different types of collections to work in a similar manner and with a high degree of interoperability. ![]() The implementations for the fundamental collections (dynamic arrays, linked lists, trees, and hashtables) were to be highly efficient. The framework had to be high-performance. The collections framework was designed to meet several goals, such as − ![]() Thus, the way that you used Vector was different from the way that you used Properties. Although these classes were quite useful, they lacked a central, unifying theme. Prior to Java 2, Java provided ad hoc classes such as Dictionary, Vector, Stack, and Properties to store and manipulate groups of objects. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |