Introduction
What is the Collection Framework?

The collections framework is a unified architecture for representing and manipulating collections, allowing them to be manipulated independently of the details of their representation. The collection framework provides better performance without complexity. It allows for interoperability among unrelated APIs, reduces the effort in designing and learning new APIs, and fosters software reuse. The framework is based on nine collection interfaces. It includes implementations of these interfaces, and algorithms to manipulate them.
The Collection framework mainly consists of the following:
- <>interfaces, the abstract data types that the framework supports.
- implementations, the concrete versions of these interfaces.
- algorithms, the predefined actions that can be defined in either the interfaces or their implementations.
- All implementations are unsynchronized.
- All implementations are serializable and cloneable.
- All implementations support having null elements.
Methods Explanation
-
asList()
The asList method of the Arrays class returns a list and it takes an array as an argument and the split method returns an array by breaking the string at spaces.
-
copy(list, sublist)
The copy method of the collection class creates a copy of a defined list and prints objects of a copy list.
-
max(list) And min(list)
The max or min methods of the collection class are useful for finding the max or min elements. -
indexOfSubList(list,searchList)
The indexOfSubList method returns an integer as index number where the SearchList is a match. -
lastIndexOfSubList(list, searchList)This method is used to find and display indexes of the last occurrence of a sublist in the list.
-
reverse(list)
The reverse method is used for making a reverse of any list. -
rotate(list, 3)
This method is used to rotate the list and where the second argument rotates the given number of objects in the list. -
swap()
The swap method is used to swap the elements at the specified positions in the specified list. -
fill(List<? super T> list, T obj)
The fill method is used to replace all of the elements of the specified list with the specified element.
Complete code


Comments
Join the conversation! Your thoughts help the community grow.