A collection is simply an object that represents a group of objects into a single unit.
Collection framework:
A collection framework is a unified architecture or a set of classes and interfaces for representing and manipulating collections. i.e. collection framework is used to store, retrieve and manipulate collections.
Collection framework contains the following:
- Interfaces are abstract data types that represent collections and allow collections to be manipulated independently of the details of their representation.
- Classes/Implementations are the concrete implementations of the collection interfaces.
- Algorithms: are the methods used for collection computations, like searching and sorting.
Advantages/Benefits of collection framework:
- Reduces programming effort: Collection framework provides useful data structure and algorithms for collection manipulation, you not have to write them.
- Increases program speed and quality: The collection framework provides high-performance and high-quality implementations of useful data structures and algorithms which increase the speed and quality.
- Resizable: Collection is resizable.
- Reduces effort to design new APIs: because the collection framework eliminates the need to produce ad hoc collections APIs.
Disadvantages of collection framework:
- It must cast to the correct type.
- It can’t be done compile-time type checking.
Note: Above two disadvantages can be removed from the collection framework by using generics.
Core Collection Framework interfaces are categories into two sets collections and maps.
Note: Maps are not an integral part of the collection framework but are considered as collections because they can store and manipulate groups of objects like collections.
Collection tutorial:
- Collection tutorial java
- Collection interfaces in java
- Collection interface in java
- List interface in java
- Set interface in java
- SortedSet interface in java
- Map interface in java
- Map.Entry interface in java
- SortedMap interface in java
- Queue interface in java
- Deque interface in java
- Enumeration interface in java
- Collection classes in java
- HashSet in java
- LinkedHashSet in java
- TreeSet in java
- ArrayList in java
- LinkedList in java
- HashMap in java
- LinkedHashMap in java
- TreeMap in java
- Abstract classes in collection framework
- PriorityQueue in java
- ArrayDeque in java
- Sorting in collection framework
- Comparable interface in java
- Comparator interface in java
- Properties class in java
- Hashtable in java
- ListIterator interface in java
- Iterate collection objects in java
- Remove element from collection
- Vector class in Java
- Read all elements in vector
- Copy or clone a vector in java
- Add all elements of a list to vector in java
- Remove all elements from vector in java
- Copy vector to array in java
- Get sub list from vector in java
- Display arraylist values by using iterator in java
- Copy or clone a arraylist in java
- Add all elements of a list to arraylist in java
- Remove all elements from arraylist in java
- Arraylist to array in java
- Get sublist from arraylist in java
- Short arraylist using comparator in java
- Reverse contents of arraylist in java
- Shuffle elements in an arraylist in java
- Swap two elements in an arraylist in java
- Read all elements in linkedlist in java
- Copy or clone linked list in java
- Add all elements of a list to linkedlist in java
- Remove all elements from a linked list in java
- Linked list to array in java
- Sort linkedlist using comparator in java
- Reverse linked list in java
- Shuffle elements in linked list in java
- Swap two elements in a linked list java
- Add an element at first and last position of linked list
- Get first element in linked list in java
- Get last element in linked list in java
- how to iterate through linked list in reverse order?
- linked list push and pop in java
- Remove element from linkedlist in java
- Iterate through hashtable in java
- Copy map content to another hashtable
- Search a key in hashtable
- Search a value in hashtable
- Get all keys from hashtable in java
- Get entrySet from hashtable in java
- Remove all elements from hashtable in java
- hash table implementation with equals and hashcode example
- Eliminate duplicate keys user defined objects with Hashtable
- Remove duplicate elements from arraylist in java
- Remove duplicate elements from a linked list in java
- Iterate a hashset in java
- Copy set content to another hashset in java
- Remove all elements from hashset in java
- Hashset to array in java
- Eliminate duplicate user defined objects from hashset in java
- Iterate a linkedhashset in java
- Linkedhashset to array in java
- Add all elements of a set to linkedhashset in java
- Remove all elements from linkedhashset in java
- Delete specific element from linkedhashset
- Check if a particular element exists in LinkedHashSet
- Eliminate duplicate user defined objects from linkedhashset
- Create treeset in java
- Iterate treeset in java
- List to treeset in java
- Remove duplicate entries from an array in java
- Find duplicate value in an array in java
- Get least value element from a set
- Get highest value element from a set
- Avoid duplicate user defined objects in TreeSet
- Create hashmap in java
- Iterate hashmap in java
- Copy map content to another hashmap in java
- Search a key in hashmap in java
- Search a value in hashmap in java
- Get list of keys from hashmap java
- Get entryset from hashmap in java
- Delete all elements from hashmap in java
- Eliminate duplicate user defined objects as a key from hashmap
- Create treemap in java
- Iterate treemap in java
- Copy map content to another treemap
- Search a key in treemap in java
- Search a value in treemap in java
- Get all keys from treemap in java
- Get entryset from treemap in java
- Remove all elements from a treeMap in java
- Sort keys in treemap by using comparator
- Get first key element from treemap in java
- Get last key element from treemap in java
- Reverse sort keys in a treemap
- Create linkedhashmap in java
- Iterate linkedhashmap in java
- Search a key in linkedhashmap in java
- Search a value in linkedhashmap in java
- Remove all entries from linkedhashmap
- Eliminate duplicate user defined objects as a key from linkedhashmap
- Find user defined objects as a key from linkedhashmap
- collection framework interview programs in java
- Java collections class
- How to add all elements to the given collection object?
- Java Collections.asLifoQueue() method
- How to search user defined object from a List by using binary search using comparator?
- Java Collections.checkedCollection() method
- Java Collections.checkedList() method
- Java Collections.checkedSet() method
- Java Collections.checkedMap() method
- Java Collections.disjoint() method
- How to create empty list using Collections class?
- How to create empty set using Collections class?
- How to create empty map using Collections class?
- java enumeration for arraylist
- how to replace element in list java?
- How to find repeated element count in a collection?
- How to convert enumeration to list in java?
- How to get index of a sub list from another list?
- How to get last index of a sub list from another list?
- How to get max element from the given list?
- How to get min element from the given list?
- How to get max element of a list of user defined objects?
- How to get min element of a list of user defined objects?
- How to get max element of a list of user defined objects using Comparator?
- How to get min element of a list of user defined objects using Comparator?
- How to create multiple copies of a given object?
- How to replace all occurrences of a given object in the list?
- how to rotate element in list java?
- how to create synchronized list in java?
- How to create synchronized set?
- How to create synchronized map?
- how to create immutable list in java?
- how to create immutable set in java?
- how to create immutable map in java?