ArrayList Problems
ArrayList is a Collection which is the implementation of Dynamic Array Data Structure.
6. How to Add an Element in Java ArrayList?
Input: Number of Elements to be Added: 3 Elements to be Added : "A" , "B" , "C" Output: list=[ A, B, C ]
7. How to remove an element from ArrayList in Java?
Input: ArrayList = [10, 20, 30, 1, 2] index=1 Output: [10, 30, 1, 2]
8. How to Replace an Element in Java ArrayList?
Input: ArrayList = [A, B, C, D] index = 2 element =' E ' Output: [ A, B, E, D ]
9. Java Program to Convert Array to ArrayList.
Input: arr = [ 2, 3, 4, 5, 8] Output: ArrayList = [ 2, 3, 4, 5, 8]
10. Comparing two ArrayList In Java
Input : ArrayList1 = [1, 2, 3, 4], ArrayList2 = [4, 2, 3, 1] Output: Array List are not equal
Java Collection Exercise
The Java Collection framework is a fundamental part of the Java programming language, It covers a major part of Java and acts as a prerequisite for many Advanced Java Topics. However, programmers often find it difficult to find a platform to Practice Java Online.
Take a look at our Java Collection Exercise that contains Java Collection Practice Problems to practice and to develop your Java Programming skills. Our Java Collection Practice Exercise will cover all the topics from Basic to Advanced, from ArrayList to Priority Queue. So, let’s dive in and sharpen our Java Collection skills together!
Table of Content
- Basic Program
- ArrayList Problems
- LinkedList Problems
- HashMap Problems
- HashSet Problems
- Stack Problems
- Queue Problems
- Priority Queue Problems