Series: List

Java List interface data structures explained like ArrayList, LinkedList

Data Structures JDK 1.5 Features

Data Structures JDK 1.5 Features Summary: This tutorial "Data Structures JDK 1.5 Features", narrates the new features added to DS with JDK 1.5 JDK 1.5 brought many changes in data structures. It not only added a new DS Queue but also added extra features to the existing collections framework. Evolution of DS with JDK Versions …

Data Structures JDK 1.5 Features Read More »

List Methods Java

List Methods Java Tutorial List interface is derived from Collection interface. The subclasses of List can utilize the methods Collection and List interfaces. The most used subclasses are ArrayList and LinkedList. ArrayList and LinkedList take the behavior of Collection interface and also the extra behavior given by List interface. List is an ordered collection of …

List Methods Java Read More »

List Example Java

Note: It is advised to read List Fundamentals before proceeding the following programs. Four programs are given on List with different functionalities. List Methods: Illustrates frequently used methods like size(), add(), get(), contains(), indexOf(), lastIndexOf(), subList(), remove(), clear() and isEmpty(). List Iteration: Illustrates comparing two lists with equals(), converting list elements to array with toArray(), …

List Example Java Read More »

ArrayList Example Methods Java

Note: Before going throuhg this "ArrayList Example Methods Java", it is adivised to read first ArrayList Introduction where all the methods, class signature, constructors and history are given. 4 programs are given on Arraylist. ArrayList Methods: In this program, the basic operations on array list are performed like addition, checking the list is empty or …

ArrayList Example Methods Java Read More »

ArrayList Reverse Search Swap Shuffle Fill Java

Note: Before going through this program ArrayList Reverse Search Swap Shuffle Fill Java, it is advised to read first ArrayList Introduction where all the methods, class signature, constructors and history are given. 4 programs are given on Arraylist. ArrayList Methods: In this program, the basic operations on array list are performed like addition, checking the …

ArrayList Reverse Search Swap Shuffle Fill Java Read More »

ArrayList Get Extract Elements Java

Note: Before going through this ArrayList Get Extract Elements Java, it is advised to read first ArrayList Introduction where all the methods, class signature, constructors and history are given. 4 programs are given on ArrayList. ArrayList Methods: In this program, the basic operations on array list are performed like addition, checking the list is empty …

ArrayList Get Extract Elements Java Read More »

ArrayList Copy Cloning Java

Note: Before going through this program ArrayList copy Cloning, it is advised to read first ArrayList Introduction where all the methods, class signature, constructors and history are given. 4 programs are given on Arraylist. ArrayList Methods: In this program, the basic operations on array list are performed like addition, checking the list is empty or …

ArrayList Copy Cloning Java Read More »

LinkedList Example Java

LinkedList Example Java is commonly used DS in every programming language. Explained all operations of adding elements, retrieve elements etc. In this program, the general methods of linked list are illustrated like poll(), peek(), offer(), size(), set(), addFirst(), addLast(), removeFirst(), removeLast(), remove(), getFirst(), getLast(), get() and isEmpty(). LinkedList Example Java import java.util.*; public class LinkedListGeneral …

LinkedList Example Java Read More »

LinkedList Sort Reverse Shuffle Example

In this program, the operations like sorting, shuffling, reversing and printing the elements in the ascending order are done. These are very common operations used by every programmer now and then. LinkedList Sort Reverse Shuffle Example import java.util.*; public class LinkedListSpecial { public static void main(String args[]) { LinkedList myList = new LinkedList(); myList.add(“one”); myList.add(“two”); …

LinkedList Sort Reverse Shuffle Example Read More »

LinkedList Iterators Get Elements Java

In this program, different styles of retrieving the elements and also extracting a few elements from the list are shown. Example on LinkedList Iterators Get Elements Java import java.util.*; public class LinkedListIterators { public static void main(String args[]) { LinkedList myList = new LinkedList(); myList.add(“one”); myList.add(“two”); myList.add(“six”); myList.add(“zero”); myList.add(“nine”); // USING FOREACH System.out.print(“Elements with foreach: …

LinkedList Iterators Get Elements Java Read More »

List Reverse Sort Java

Note: It is advised to read List Fundamentals before proceeding the following programs. Four programs are given on List with different functionalities. List Methods: Uses frequently used methods like size(), add(), get(), contains(), indexOf(), lastIndexOf(), subList(), remove(), clear() and isEmpty(). List Iteration: Comparing two lists with equals(), converting list elements to array with toArray(), printing …

List Reverse Sort Java Read More »

Queue Offer Poll Peek Remove Elements Java

Note: Before going into the details of this "Queue Offer Poll Peek Remove Elements Java", it is advised to go through Queue Fundamentals where queue basics were discussed. Following are some methods that do the similar operations. boolean offer(Object obj): Adds the element obj to the queue. If the addition is successful, the method returns …

Queue Offer Poll Peek Remove Elements Java Read More »

List Remove Duplicate Elements Java

Note: It is advised to read List Fundamentals before proceeding the following programs. Four programs are given on List with different functionalities. List Methods: Uses frequently used methods like size(), add(), get(), contains(), indexOf(), lastIndexOf(), subList(), remove(), clear() and isEmpty(). List Iteration: Comparing two lists with equals(), converting list elements to array with toArray(), printing …

List Remove Duplicate Elements Java Read More »

ArrayList of arrays Java

Sometimes it may be necessary to store arrays in ArayList in coding. It is also necessary to retrieve the elements of the arrays when required. Another similar concept program is available "Array of Array Lists" that stores array lists in an array of array list. Example on ArrayList of arrays import java.util.*; public class Demo …

ArrayList of arrays Java Read More »