Java Collection : ArrayList - Exercises and Solution


1. Write a Java program to create a new array list, add some elements (string) and print out the collection

View Solution

2. Write a Java program to insert an element into the array list at the first position

View Solution

3. Write a Java program to remove the fifth element from a array list

View Solution

4. Write a Java program to sort a given array list

View Solution

5. Write a Java program to shuffle elements in a array list

View Solution

6. Write a Java program to increase the size of an array list

View Solution

7. Write a Java program to reverse elements in a array list

View Solution

8. Write a Java program to compare two array lists

View Solution

9. Write a Java program to swap two elements in an array list

View Solution

10. Write a Java program to join two array lists

View Solution

11. Write a Java program to empty an array list

View Solution

12. Write a Java program to retrieve an element (at a specified index) from a given array list

View Solution

13. Write a Java program to update specific array element by given element

View Solution

14. Write a Java program to search an element in a array list

View Solution

15. Write a Java program to copy one array list into another

View Solution

16. Write a Java program to extract a portion of a array list

View Solution

17. Write a Java program to clone an array list to another array list

View Solution

18. Write a Java program to test an array list is empty or not

View Solution

19. Write a Java program to trim the capacity of an array list the current list size

View Solution

20. Write a Java program to print all the elements of a Array List using the position of the elements

View Solution

21. Write a Java program to Find maximum element in ArrayList

View Solution

22. Write a Java program to Find minimum element in ArrayList

View Solution

23. Write a Java program to ArrayList of user defined objects

View Solution

24. Write a Java program to Searching for elements in an ArrayList

View Solution

25. Write a Java program how do you find the number of elements present in an ArrayList

View Solution

26. Write a Java program how do you decrease the current capacity of an ArrayList to the current size

View Solution

27. Write a Java program how to Convert a ArrayList to HashSet

View Solution

28. Write a Java Program to find number of elements in ArrayList

View Solution

29. Write a Java program to get SubList from ArrayList

View Solution

30. Write a Java program to Remove Duplicates from ArrayList

View Solution

31. Write a Java program to Convert an ArrayList to Array

View Solution

32. Write a Java program to insert an element at a particular position of an ArrayList

View Solution

33. Write a Java program to Remove an element from a particular position of an ArrayList

View Solution

34. Write a Java program to Remove the given element from an ArrayList

View Solution

35. Write a Java program to Remove all elements of an ArrayList at a time

View Solution

36. Write a Java program to Insert more than one element at a particular position of an ArrayList

View Solution

37. Write a Java program to Retrieve a portion of an ArrayList

View Solution

38. Write a Java program to Replace a particular element in an ArrayList with the given element

View Solution

39. Write a Java program to get the position of a particular element in an ArrayList

View Solution

40. Write a Java program to check whether the given element is present in an ArrayList or not

View Solution



Basic Programs