

{"id":14198,"date":"2018-04-28T09:33:54","date_gmt":"2018-04-28T09:33:54","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=14198"},"modified":"2026-05-22T15:16:50","modified_gmt":"2026-05-22T09:46:50","slug":"collections-in-java","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/collections-in-java\/","title":{"rendered":"Collections in Java &#8211; Types of Interface In Java"},"content":{"rendered":"<p>In Java, a set or group of objects is known as a collection. Several interfaces, classes, and Algorithms together form the Collection Framework. Collections and the Collection framework are two very important concepts in Java when it comes to handling and organizing data. In this article, we will take a look at all the various collections that are present in the Java programming language and how we can implement them in our code.<\/p>\n<h3>Collections in Java<\/h3>\n<p>The collection is an interface that provides various other interfaces and classes that help store and manipulate groups of objects. It helps in various operations such as searching, sorting, insertion, manipulation, and deletion.<\/p>\n<p>The Java Collection provides various interfaces, such as Set, List, Queue, Deque, and various classes, such as ArrayList, Vector, LinkedList, PriorityQueue, HashSet, LinkedHashSet, TreeSet, etc.<\/p>\n<h3>Java Collection Interface<\/h3>\n<p>The Collection interface is the root of the collection framework. Every other interface and class implements the Collection interface. It declares all the methods like Boolean add(Object obj), Boolean addAll (Collection c), void clear(), etc., which are implemented by all the subclasses of the Collection interface.<\/p>\n<p>We will now discuss all the interfaces and classes that fall under the Collection Interface.<\/p>\n<h3>Java List Interface<\/h3>\n<p>List interface is a child interface of the Collection Interface. It stores data in the form of a list-type data structure. We can store an ordered collection of objects in it. It is possible to have duplicates in this type of data structure.<\/p>\n<p>The classes ArrayList, LinkedList, Vector, and Stack implement the List Interface.<\/p>\n<p><strong>The List interface is instantiated using the following statements:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">List &lt;data-type&gt; list1= new ArrayList();  \r\n<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">List &lt;data-type&gt; list2 = new LinkedList();  \r\n<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">List &lt;data-type&gt; list3 = new Vector();  \r\n<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">List &lt;data-type&gt; list4 = new Stack();  \r\n<\/pre>\n<p>Let us see the use of each of these classes individually.<\/p>\n<h3>Java ArrayList<\/h3>\n<p>The ArrayList class implements the List Interface to create a dynamic array. Thus, it is a more flexible form of the default static array. However, the ArrayList class always maintains the insertion order and is always non-synchronized. The ArrayList can be accessed randomly.<\/p>\n<p><strong>Code to Understand the Implementation of ArrayList:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.Collections;\r\nimport java.util.*;\r\npublic class Arraylist\r\n{\r\n    public static void main(String args[])\r\n    {  \r\n        ArrayList&lt;Integer&gt; arr=new ArrayList&lt;Integer&gt;(); \r\n        arr.add(1);\r\n        arr.add(7);  \r\n        arr.add(10);  \r\n        arr.add(50);  \r\n        Iterator i=arr.iterator();  \r\n        while(i.hasNext())\r\n        {  \r\n            System.out.println(i.next());  \r\n        }  \r\n    }  \r\n}  \r\n<\/pre>\n<p><strong>The output of the above code:<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n7<br \/>\n10<br \/>\n50<\/div>\n<h3>Java LinkedList<\/h3>\n<p>The LinkedList also implements the List Interface. Internally, the LinkedList class uses a doubly linked list to store data. Therefore, it can also store duplicate elements and maintain the insertion order in a non-synchronized form. Although Data manipulation is faster in LinkedList because there is no shifting required.<\/p>\n<p><strong>Code to understand the implementation of LinkedList:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.Collections;\r\nimport java.util.*;\r\npublic class Linkedlist\r\n{\r\n    public static void main(String args[])\r\n   {  \r\n        LinkedList&lt;Integer&gt; L=new LinkedList&lt;Integer&gt;();  \r\n        L.add(1);  \r\n        L.add(7);  \r\n        L.add(10);  \r\n        L.add(50);  \r\n        Iterator&lt;Integer&gt; i=L.iterator();  \r\n        while(i.hasNext())\r\n        {  \r\n            System.out.println(i.next());  \r\n        }  \r\n   }  \r\n}\r\n<\/pre>\n<p><strong>The output of the above code:<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n7<br \/>\n10<br \/>\n50<\/div>\n<h3>Java Vector<\/h3>\n<p>It is the same as the ArrayList in every aspect, except for the fact that vectors are synchronized and contain many methods that are not part of the Collection Framework.<\/p>\n<p><span style=\"font-weight: 400\">Vectors in Java are a type of array; their size can increase or decrease. However, an array has a defined size at the time of creation. So, to overcome this constraint, a vector was introduced.\u00a0<\/span><\/p>\n<p><strong>Code to understand the implementation of Vector:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.Collections;\r\nimport java.util.*;\r\npublic class Vectors\r\n{\r\n    public static void main(String args[])\r\n    {  \r\n        Vector&lt;Integer&gt; v=new Vector&lt;Integer&gt;();  \r\n        v.add(1);  \r\n        v.add(7);  \r\n        v.add(10);  \r\n        v.add(50);  \r\n        Iterator&lt;Integer&gt; i=v.iterator();  \r\n        while(i.hasNext())\r\n        {  \r\n            System.out.println(i.next());  \r\n        }  \r\n}  \r\n}\r\n<\/pre>\n<p><strong>The output of the above code:<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n7<br \/>\n10<br \/>\n50<\/div>\n<h3>Java Stack<\/h3>\n<p>Stack is a subclass of the vector class. It follows the LIFO(Last In, First Out) principle of data structure. Thus, Stack contains all the methods of the Vector class and has methods like push(), peek(), and pop() of its own.<\/p>\n<p><strong>Code to understand the implementation of Stack:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.Collections;\r\nimport java.util.*;\r\npublic class Stacks\r\n{\r\n    public static void main(String args[])\r\n    {  \r\n        Stack&lt;Integer&gt; s = new Stack&lt;Integer&gt;();  \r\n        s.push(1);  \r\n        s.push(7);  \r\n        s.push(10);  \r\n        s.push(50);  \r\n        s.push(100);  \r\n        s.pop();  \r\n        Iterator&lt;Integer&gt; itr=s.iterator();  \r\n        while(itr.hasNext())\r\n        {  \r\n            System.out.println(itr.next());  \r\n        }  \r\n}  \r\n}\r\n<\/pre>\n<p><strong>The output of the above code:<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n7<br \/>\n10<br \/>\n50<\/div>\n<h3>Java Queue Interface<\/h3>\n<p>The Queue Interface implements the Collection Interface. It maintains the FIFO(First In First Out) principle of Data Structure. It holds elements in an ordered list. Therefore, Various classes and interfaces implement the Queue Interface, like PriorityQueue, Deque, and ArrayDeque<\/p>\n<p><strong>The queue interface can be instantiated as follows:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Queue&lt;String&gt; q1 = new PriorityQueue();  \r\n<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Queue&lt;String&gt; q2 = new ArrayDeque();  \r\n\r\n<\/pre>\n<p>Let us discuss the classes and interfaces that implement the Queue interface.<\/p>\n<h3>Java PriorityQueue<\/h3>\n<p>The PriorityQueue class implements the Queue interface. Thus, it holds the elements or objects by their priorities. Null values are not allowed in the PriorityQueue.<\/p>\n<p><strong>Code to implement PriorityQueue:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.Collections;\r\nimport java.util.*;\r\npublic class priority_queue\r\n{\r\n    public static void main(String args[])\r\n    {  \r\n        PriorityQueue&lt;Integer&gt; queue=new PriorityQueue&lt;Integer&gt;();  \r\n        queue.add(1);  \r\n        queue.add(7);  \r\n        queue.add(10);  \r\n        queue.add(50);  \r\n        System.out.println(\"High Priority:\"+queue.element());  \r\n        System.out.println(\"High Priority:\"+queue.peek());  \r\n        System.out.println(\"Iterating through the queue :\");  \r\n        Iterator itr=queue.iterator();  \r\n        while(itr.hasNext()){  \r\n            System.out.println(itr.next());  \r\n        }  \r\n        queue.remove();  \r\n        queue.poll();  \r\n        System.out.println(\"After removing two elements from the Queue:\");  \r\n        Iterator&lt;Integer&gt; itr2=queue.iterator();  \r\n        while(itr2.hasNext()){  \r\n            System.out.println(itr2.next());  \r\n        }  \r\n}\r\n}\r\n<\/pre>\n<p><strong>The output of the above queue:<\/strong><\/p>\n<div class=\"code-output\">High Priority:1<br \/>\nHigh Priority:1<br \/>\nIterating through the queue :<br \/>\n1<br \/>\n7<br \/>\n10<br \/>\n50<br \/>\nAfter removing two elements from the Queue:<br \/>\n10<br \/>\n50<\/div>\n<h3>Java Deque Interface<\/h3>\n<p>The Deque Interface extends the Queue Interface. The Deque interface allows us to add and remove elements from both sides. However, it is basically a double-ended queue and is more flexible than a regular queue.<\/p>\n<p><strong>The deque interface can be instantiated by:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Deque d = new ArrayDeque();  \r\n<\/pre>\n<h3>Java ArrayDeque<\/h3>\n<p>The ArrayDeque class implements the Deque interface. It helps us implement the double-ended queue. However, ArrayDeque is faster than ArrayList and Stack and has no capacity restrictions, thus making it better and more flexible.<\/p>\n<p><strong>Code to understand the implementation of ArrayDeque:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.Collections;\r\nimport java.util.*;\r\npublic class ArrayDQ\r\n{\r\n    public static void main(String[] args) \r\n    {  \r\n        Deque&lt;Integer&gt; deque = new ArrayDeque&lt;Integer&gt;();  \r\n        deque.add(1);  \r\n        deque.add(7);  \r\n        deque.add(10);    \r\n        deque.add(50);    \r\n        for (int i : deque) \r\n        {  \r\n            System.out.println(i);  \r\n        }  \r\n    }\r\n}\r\n<\/pre>\n<p><strong>The output of the above code:<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n7<br \/>\n10<br \/>\n50<\/div>\n<h3>Java Set Interface<\/h3>\n<p>The Set interface also extends the Collection Interface. In a set, the list of elements is unordered, and the elements need to be unique, i.e, duplicates are not allowed. Only one Null value is allowed in a set. However, the set is implemented by the HashSet, LinkedHashSet, and TreeSet classes.<\/p>\n<p><strong>Set interface can be instantiated as:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Set&lt;data-type&gt; s1 = new HashSet&lt;data-type&gt;();  \r\n<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Set&lt;data-type&gt; s2 = new LinkedHashSet&lt;data-type&gt;();<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Set&lt;data-type&gt; s3 = new TreeSet&lt;data-type&gt;();  \r\n\r\n<\/pre>\n<h3>Java HashSet<\/h3>\n<p>The HashSet class implements the Set Interface. It uses a hash table for storing elements. However, hashing is used to store the elements in a HashSet. However, each element in the HashSet is Unique. The insertion order is not maintained in HashSet.<\/p>\n<p><strong>Code to understand the implementation of HashSet:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.Collections;\r\nimport java.util.*;\r\npublic class Hashset\r\n{\r\n    public static void main(String args[])\r\n    {  \r\n        HashSet&lt;Integer&gt; set=new HashSet&lt;Integer&gt;();  \r\n        set.add(1);  \r\n        set.add(7);  \r\n        set.add(10);  \r\n        set.add(50);   \r\n        Iterator&lt;Integer&gt; itr=set.iterator();  \r\n        while(itr.hasNext())\r\n        {  \r\n            System.out.println(itr.next());  \r\n        }  \r\n    }  \r\n}\r\n<\/pre>\n<p><strong>The output of the above code:<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n50<br \/>\n7<br \/>\n10<\/div>\n<h3>Java LinkedHashSet<\/h3>\n<p>LinkedHashSet class implements the Set interface to represent the implementation of LinkedList. Thus, it extends the HashSet class. LinkedHashSet also has unique elements. Although it maintains the insertion order. Only one Null value is allowed.<\/p>\n<p><strong>Code to understand the implementation of LinkedHashSet:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.Collections;\r\nimport java.util.*;\r\npublic class LinkedHashset\r\n{\r\n    public static void main(String args[])\r\n    {  \r\n        LinkedHashSet&lt;Integer&gt; set=new LinkedHashSet&lt;Integer&gt;();  \r\n        set.add(1);  \r\n        set.add(7);  \r\n        set.add(10);  \r\n        set.add(50);  \r\n        Iterator&lt;Integer&gt; itr=set.iterator();  \r\n        while(itr.hasNext())\r\n        {  \r\n            System.out.println(itr.next());  \r\n        }  \r\n    }\r\n}\r\n<\/pre>\n<p><strong>The output of the above code is:<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n7<br \/>\n10<br \/>\n50<\/div>\n<h3>Java SortedSet Interface<\/h3>\n<p>The SortedSet interface implements the Set interface. In this interface, the elements are stored in increasing order.<\/p>\n<p><strong>The SortedSet interface is instantiated by:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SortedSet&lt;data-type&gt; set = new TreeSet();  \r\n<\/pre>\n<h3>Java TreeSet<\/h3>\n<p>TreeSet is a class that extends the SortedSet Interface. Java TreeSet works by representing the data in a tree structure for data sorting and data storage. However, the tree set does not allow storing duplicate data. Hence, the element stored in the tree set must be unique, resulting in reduced data redundancy. Although elements are also stored in ascending order.<\/p>\n<p>However, the tree set prohibits the use of null values; if added, it will throw an exception.<\/p>\n<p><strong>Code to understand the implementation of TreeSet:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.Collections;\r\nimport java.util.*;\r\npublic class Treeset\r\n{\r\n    public static void main(String args[])\r\n    {  \r\n        TreeSet&lt;Integer&gt; set=new TreeSet&lt;Integer&gt;();  \r\n        set.add(1);  \r\n        set.add(10);  \r\n        set.add(50);  \r\n        set.add(7);   \r\n        Iterator&lt;Integer&gt; itr=set.iterator();  \r\n        while(itr.hasNext())\r\n        {  \r\n            System.out.println(itr.next());  \r\n        }  \r\n    }  \r\n}\r\n<\/pre>\n<p><strong>The output of the above code is:<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n7<br \/>\n10<br \/>\n50<\/div>\n<h3>Summarizing the Java Collection Interface<\/h3>\n<table style=\"height: 500px\" width=\"785\">\n<tbody>\n<tr>\n<td><b>Interface<\/b><\/td>\n<td><b>Collection Class<\/b><\/td>\n<td><b>Ordered<\/b><\/td>\n<td><b>Sorted<\/b><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"3\"><span style=\"font-weight: 400\">List<\/span><\/td>\n<td><span style=\"font-weight: 400\">ArrayList<\/span><\/td>\n<td><span style=\"font-weight: 400\">Indexed<\/span><\/td>\n<td><span style=\"font-weight: 400\">No<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Vector<\/span><\/td>\n<td><span style=\"font-weight: 400\">Indexed<\/span><\/td>\n<td><span style=\"font-weight: 400\">No<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">LinkedList<\/span><\/td>\n<td><span style=\"font-weight: 400\">Indexed<\/span><\/td>\n<td><span style=\"font-weight: 400\">No<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Queue<\/span><\/td>\n<td><span style=\"font-weight: 400\">Priority Queue<\/span><\/td>\n<td><span style=\"font-weight: 400\">Sorted<\/span><\/td>\n<td><span style=\"font-weight: 400\">By to-do order<\/span><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"3\"><span style=\"font-weight: 400\">Set<\/span><\/td>\n<td><span style=\"font-weight: 400\">HashSet<\/span><\/td>\n<td><span style=\"font-weight: 400\">No<\/span><\/td>\n<td><span style=\"font-weight: 400\">No<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">TreeSet<\/span><\/td>\n<td><span style=\"font-weight: 400\">Sorted<\/span><\/td>\n<td><span style=\"font-weight: 400\">By natural order or custom order<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">LinkedHashSet<\/span><\/td>\n<td><span style=\"font-weight: 400\">By insertion Order<\/span><\/td>\n<td><span style=\"font-weight: 400\">No<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Iterating Through Collections in Java<\/h3>\n<p>Java collections provide various ways to iterate through their elements. Here are two common approaches:<\/p>\n<p><strong>Iterators<\/strong>: The Iterator interface provides a way to iterate through a collection&#8217;s elements one at a time. Therefore, you can obtain an iterator from a collection using its iterator() method. The iterator has methods like hasNext() to check if there are more elements and next() to get the next element.<\/p>\n<p><strong>For-each loop:<\/strong> Java provides a more concise way to iterate through collections using the for-each loop. Thus, this loop automatically iterates over each element in the collection and assigns it to a temporary variable.<\/p>\n<h3>Conclusion<\/h3>\n<p>In this article, we saw the main interfaces that implement the Collection interface and their respective extended classes. Although Java Collections help store and maintain data with ease, knowing the concept of Java Collections makes the programs very easy to implement.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Java, a set or group of objects is known as a collection. Several interfaces, classes, and Algorithms together form the Collection Framework. Collections and the Collection framework are two very important concepts in&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":108860,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[2633,2636,3769,7337,7579,7583,7691,8518,12767,13967,15065],"class_list":["post-14198","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-collection-framework-in-java","tag-collections-in-java","tag-deque-java","tag-iterator-interface-in-java","tag-java-line","tag-java-list-interface","tag-java-stack","tag-map-interface-in-java","tag-set-interface-in-java","tag-subtypes-of-collection-in-java","tag-types-of-interface-in-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Collections in Java - Types of Interface In Java - DataFlair<\/title>\n<meta name=\"description\" content=\"What are Collections in Java-Types of Interface in Java: Set, List, Map, Subtypes of Java Collection: Deque, Java Line, Java Stack etc.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/collections-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Collections in Java - Types of Interface In Java - DataFlair\" \/>\n<meta property=\"og:description\" content=\"What are Collections in Java-Types of Interface in Java: Set, List, Map, Subtypes of Java Collection: Deque, Java Line, Java Stack etc.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/collections-in-java\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-28T09:33:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-22T09:46:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/collections-in-java.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Collections in Java - Types of Interface In Java - DataFlair","description":"What are Collections in Java-Types of Interface in Java: Set, List, Map, Subtypes of Java Collection: Deque, Java Line, Java Stack etc.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/collections-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Collections in Java - Types of Interface In Java - DataFlair","og_description":"What are Collections in Java-Types of Interface in Java: Set, List, Map, Subtypes of Java Collection: Deque, Java Line, Java Stack etc.","og_url":"https:\/\/data-flair.training\/blogs\/collections-in-java\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-04-28T09:33:54+00:00","article_modified_time":"2026-05-22T09:46:50+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/collections-in-java.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/collections-in-java\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/collections-in-java\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Collections in Java &#8211; Types of Interface In Java","datePublished":"2018-04-28T09:33:54+00:00","dateModified":"2026-05-22T09:46:50+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/collections-in-java\/"},"wordCount":1229,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/collections-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/collections-in-java.webp","keywords":["Collection Framework in Java","Collections in Java","Deque Java","Iterator Interface in Java","Java Line","Java List Interface","Java Stack","Map Interface in Java","Set Interface in Java","Subtypes of Collection in Java","Types of Interface in Java"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/collections-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/collections-in-java\/","url":"https:\/\/data-flair.training\/blogs\/collections-in-java\/","name":"Collections in Java - Types of Interface In Java - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/collections-in-java\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/collections-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/collections-in-java.webp","datePublished":"2018-04-28T09:33:54+00:00","dateModified":"2026-05-22T09:46:50+00:00","description":"What are Collections in Java-Types of Interface in Java: Set, List, Map, Subtypes of Java Collection: Deque, Java Line, Java Stack etc.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/collections-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/collections-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/collections-in-java\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/collections-in-java.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/collections-in-java.webp","width":1200,"height":628,"caption":"collections in java"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/collections-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Java Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/java\/"},{"@type":"ListItem","position":3,"name":"Collections in Java &#8211; Types of Interface In Java"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/14198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=14198"}],"version-history":[{"count":13,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/14198\/revisions"}],"predecessor-version":[{"id":148396,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/14198\/revisions\/148396"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/108860"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=14198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=14198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=14198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}