Courses
Tutorials
Practice
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
37.4K+ articles
Java
10.8K+ articles
Misc
8.8K+ articles
Java Programs
2.0K+ articles
Java - util package
1.6K+ articles
Java-Collections
1.1K+ articles
Java-ArrayList
154+ articles
java-stream
142+ articles
java-list
95+ articles
Java-Stream-programs
27+ articles
Java-List-Programs
55 posts
Recent Articles
Popular Articles
How to Find a Sublist in a List in Java?
Last Updated: 22 October 2020
List in Java contains index-based methods. This enables us to maintain the order collection. So this enables us to search, insert, delete, and even update the elements. Th...
read more
Java
Java Programs
java-list
Picked
Java-List-Programs
Initialize a list in a single line with a specified value
Last Updated: 02 January 2020
Given a value N, the task is to create a List having this value N in a single line in Java using Collection Framework only.Examples:Input: N = 5Output: [5]Input: N = Geeks...
read more
Java
Java-List-Programs
How to initialize a list in a single line in Java with a specified value?
Last Updated: 16 December 2019
Given a value N, the task is to create a List having this value N in a single line in Java.Examples:Input: N = 5Output: [5]Input: N = GeeksForGeeksOutput: [GeeksForGeeks]A...
read more
Java
Java-List-Programs
How to remove a SubList from a List in Java
Last Updated: 18 January 2019
Given a list in Java, the task is to remove all the elements in the sublist whose index is between fromIndex, inclusive, and toIndex, exclusive. The range of the index is ...
read more
Java
java-list
Picked
Java-List-Programs
Randomly Select Items from a List in Java
Last Updated: 12 February 2025
In this article, we will explore how to efficiently select an element from a list in Java. The basic approach involves generating a random index between 0 and the size of ...
read more
Java
Technical Scripter
java-list
Technical Scripter 2018
Java-List-Programs
Difference Between ArrayList and HashMap in Java
Last Updated: 20 January 2022
ArrayList is a part of the collection framework and is present in java.util package. It provides us with dynamic arrays in Java. Though, it may be slower than standard arr...
read more
Java
Technical Scripter
Java-Collections
Java-ArrayList
Java-HashMap
Technical Scripter 2018
Java-List-Programs
Java-Map-Programs
Difference between ArrayList and HashSet in Java
Last Updated: 08 May 2023
Here are couple of differences between ArrayList and HashSet.Inheritance: Implementation: Implementation : ArrayList implements List interface while HashSet implements Set...
read more
Java
Technical Scripter
Java-Collections
Difference Between
Java-ArrayList
java-hashset
Technical Scripter 2018
Java-List-Programs
Java-Set-Programs
Difference Between LinkedList and LinkedHashSet in Java
Last Updated: 11 December 2018
In this article you will learn difference between LinkedList and LinkedHashSet in java.Prerequisite: LinkedList : LinkedHashSetLinkedList class implements the List and De...
read more
Java
Technical Scripter
java-LinkedList
java-LinkedHashSet
Technical Scripter 2018
Java-List-Programs
Java-Set-Programs
Get first and last elements from ArrayList in Java
Last Updated: 07 June 2019
Given an array list, find the first and last elements of it.Examples:Input : aList = {10, 30, 20, 14, 2}Output : First = 10, Last = 2Input : aList = {10, 30, 40, 50, 60}Ou...
read more
Java
Technical Scripter
Java-Collections
Java-ArrayList
Technical Scripter 2018
Java-List-Programs
Min and Max in a List in Java
Last Updated: 11 January 2023
Given an unsorted list of integers, find maximum and minimum values in it.Input : list = [10, 4, 3, 2, 1, 20]Output : max = 20, min = 1Input : list = [10, 400, 3, 2, 1, -1...
read more
Linked List
Java
Technical Scripter
java-LinkedList
Technical Scripter 2018
Java-List-Programs
DSA
Split a List into Two Halves in Java
Last Updated: 10 August 2022
Here we are given a list and the task is to split it into two news lists as one can better perceive from the below illustration as follows:Illustration:Input : list = {1,...
read more
Java
Java-Collections
Java-ArrayList
java-list
Technical Scripter 2018
Java-List-Programs
Convert a List of String to a comma separated String in Java
Last Updated: 21 October 2022
Given a List of String, the task is to convert the List to a comma separated String in Java.Examples:Input: ListString = ["Geeks", "ForGeeks", "GeeksForGeeks"]Output: "Gee...
read more
Java
Java-Strings
Java Programs
Java-String-Programs
Java-List-Programs
How to Remove Duplicates from ArrayList in Java
Last Updated: 11 December 2018
Given an ArrayList with duplicate values, the task is to remove the duplicate values from this ArrayList in Java.Examples:Input: List = [1, 10, 2, 2, 10, 3, 3, 3, 4, 5, 5]...
read more
Java
Java-Collections
Java-ArrayList
java-LinkedHashSet
Java-List-Programs
How to Add Element at First and Last Position of LinkedList in Java?
Last Updated: 15 November 2021
LinkedList is a part of Collection framework present inside java.util package. This class is an implementation of LinkedList data structure which is a linear data structur...
read more
Java
Java-Collections
java-LinkedList
Java-List-Programs
How to convert LinkedList to Array in Java?
Last Updated: 28 June 2022
Given a Linked List in Java, the task is to convert this LinkedList to Array. Examples:Input: LinkedList: ['G', 'e', 'e', 'k', 's'] Output: Array: ['G', 'e', 'e', 'k', 's'...
read more
Java
Java-Collections
Java-Arrays
java-LinkedList
Java-Array-Programs
Java-List-Programs
1
2
3
4
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !