added interfaces and classes in collections (#26548)

* added interfaces and classes in collections

* updated formatting as requested
This commit is contained in:
Maddineni Akhil
2019-01-24 10:13:06 +05:30
committed by Manish Giri
parent a1349084ba
commit 062631ef10

View File

@ -3,7 +3,7 @@ title: Collections
---
# Collections
A Collection in Java is a group of objects which can be ordered (List) or unordered (Set). The `Collection` interface is at the top of the hierarchy and all other classes and interfaces extend from this interface. It is located in the `java.util` package.
A Collection in Java is a group of objects which can be ordered (List) or unordered (Set). The `Collection` interface is at the top of the hierarchy and all other classes and interfaces extend from this interface. It is located in the `java.util` package. It provides many interfaces like `Set`, `List`, `Queue`, `Deque` etc. and classes like `ArrayList`, `Vector`, `LinkedList`, `PriorityQueue`, `HashSet`, `LinkedHashSet` etc.
The `Collection` interface also extends the `Iterable` interface, which means that every collection in java must be iterable. This in turn means that a `for-each` loop can be used to fetch elements from a collection in a sequence.