Posts tagged "Java Collection "

Tag Archives: Java Collection

Methods in LinkedList

Let’s learn Methods in LinkedList. In the previous tutorial, We have seen the implementation and example of LinkedList in Java. Here, We are going to discuss the important methods present in the LinkedListclass.   How to Declare LinkedList – We can declare the LinkedList same like ArrayList class. LinkedList<String> stringList = new LinkedList<String> ; // Generic ArrayList to store only … Continue reading Methods in LinkedList

LinkedList in Java

In previous tutorials, We have learned about the ArrayList class of the Java Collection. In this tutorial, we will learn about the LinkedList class of the Java Collection. LinkedList is a class which implements the List interface of collection framework. Java LinkedList class uses doubly linked list to store the elements. Like ArrayList, LinkedList also can contain the … Continue reading LinkedList in Java

Methods in ArrayList

ArrayList in Java is most frequently used collection class after HashMap in Java. Let’s see how many methods in ArrayList is available. Java ArrayList represents an automatic re-sizable array and used in place of the array. In this tutorial, we will see the different examples and uses of ArrayList in Java. How to Create an ArrayList  We already have seen, … Continue reading Methods in ArrayList

How to get Sublist from ArrayList

In this tutorial we will see, How can you get Sublist from ArrayList or how can we generate the ArrayList from existing ArrayList. We can do this using subList() method of ArrayList class. List subList(int fromIndex, int toIndex)   Get Sublist from ArrayList in Java You can get the Sublist using this method by specifying the … Continue reading How to get Sublist from ArrayList

Insert and Delete in ArrayList

In this tutorial we will see, How can you insert and delete in ArrayList in Java. Unlike Array In Java, ArrayList is a dynamic data structure. ArrayList can increase and decrease its size at runtime, We don’t need to declare the ArrayList’s size at the time of ArrayList implementation. It’s also shrinking in memory if … Continue reading Insert and Delete in ArrayList

Sort ArrayList in Java

Let’s see How can you sort the ArryList in Java. By default, the ArrayList’s elements are displayed according to the sequence it is put inside. Sometimes, you may need to sort the ArrayList to make it alphabetically ordered or numerically ordered. In this example, it shows the use of  Collections.sort(‘List’) to sort an ArrayList.   Sort ArrayList in ascending order … Continue reading Sort ArrayList in Java

ArrayList in Java

ArrayList in Java is a class which implements the List interface of collection framework. ArrayList is dynamic data structure i.e like Arrays you don’t need to define the size of ArrayList during the declaration. You can add and remove the elements from ArrayList and ArrayList adjust it’s size automatically. ArrayList can contain the duplicate elements and … Continue reading ArrayList in Java

Iterator in Java

Let’s learn about Iterator in Java, The iterator is used to iterating the classes in Collection framework. We use an iterator to iterating the elements of the collection classes. The iterator is an interface. You need to know some important points about Iterator- You can iterate only in one direction. Iteration can be done only once. … Continue reading Iterator in Java

Java Collection Framework

Collections are like containers that group multiple items in a single unit also Java Collections Framework is a collection of interfaces and classes which help in storing and processing the data efficiently. Collection Framework provides an architecture to store and manipulates the group of objects. Collections are used almost in every programming language and when Java arrived, … Continue reading Java Collection Framework