Home » Java programming language

Interfaces used in Collection framework in Java

Here, we are going to learn about the various interfaces used in Collection framework? What is the different type of interface which is used in Collection framework?
Submitted by Preeti Jain, on July 24, 2019

There are various interfaces which are used in Collection framework and we will see the names of the name of all those interfaces which is introduced in the Collection framework.

  1. Collection interface
  2. List interface
  3. Set interface
  4. SortedSet interface
  5. NavigableSet interface
  6. Queue interface
  7. Map interface
  8. SortedMap interface
  9. NavigableMap interface

Now, we will study each interface one by one of Collection framework in detail...

1) Collection interface

  • This interface is available in the package java.util.Collection.
  • This interface is the root or base interface of Collection framework and every Collection framework class must implement this interface.
  • Collection interface is what if we want to represent a group of individual objects as a single entity then we should for Collection.

2) List interface

  • This interface is available in the package java.util.List.
  • This interface is the child interface of Collection framework.
  • List interface is what if we want to represent a group of individual objects as a single entity where insertion order is preserved and duplicate objects are allowed.

3) Set interface

  • This interface is available in the package java.util.Set.
  • The set interface is the child interface of Collection framework.
  • The set interface is what if we want to represent a group of individual objects as a single entity and where insertion order is not preserved and duplicate objects are not allowed.

4) SortedSet interface

  • This interface is available in the package java.util.SortedSet.
  • This interface is the child interface of the Set interface.
  • SortedSet interface is what if we want to represent a group of individual objects according to some sorting order.

5) NavigableSet interface

  • This interface is available in the package java.util.NavigableSet.
  • This interface is the child interface of the SortedSet interface.
  • NavigableSet interface is what if we want to represent a group of individual objects as a single entity according to some sorting order.
  • This interface provides methods for navigation purpose.

6) Queue interface

  • This interface is available in the package java.util.Queue.
  • This interface is the child interface of Collection.
  • Queue interface is what if we want to represent a group of individual objects before processing then we should for Queue.

7) Map interface

  • This interface is available in the package java.util.Map.
  • This interface is the child interface of Collection.
  • The map interface is what if we want to represent a group of individual objects as a key-value pair and here key will be unique and value can be duplicated.

8) SortedMap interface

  • This interface is available in the package java.util.SortedMap.
  • This interface is the child interface of Map.
  • The map interface is what if we want to represent a group of individual objects as a key-value pair according to some sorting order.

9) NavigableMap interface

  • This interface is available in the package java.util.Map.
  • This interface is the child interface of SortedMap.
  • NavigableMap interface is what if we want to represent a group of individual objects as a key-value pair according to some sorting order and this interface provides methods for navigation purpose.


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.