Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Collection and generics
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
collections in java

The Collection in Java is a framework that provides an architecture to store and manipulate the group of objects.

Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.

Java Collection means a single unit of objects. Java Collection framework provides many interfaces (Set, List, Queue, Deque) and classes (ArrayList, Vector, LinkedList, PriorityQueue, HashSet, LinkedHashSet, TreeSet).

problem with arrays is that we can expand them , for this we can use collections , which acts as a interface . If the number of elements is fixed use arrays or else use collections.

object types in collections is also known as generics, we can perform multiple operations on collections

we can also use list to define integer values

we can also use set , but in set we cannot have duplicate values , every element will be unique

we get random values in hash set , using tree set we get sorted values in ascending order.

we can also work with map , where we have a key value pair .