Collection - Lab Exercise
Collection - Lab Exercise
Practice questions |
ArrayList |
1) Write a program to create an array list, add some colors (strings) and print out the collection ?
|
2) Write a program to iterate through all elements in an array list ?
|
3) Write a program to insert an element into the array list at the first position ?
|
Linked List |
1) Write a program to append the specified element to the end of LinkedList ?
|
2) Write a program to iterate through all elements in linked list starting at the specified position ?
|
3) Write a program to iterate a linked list in reverse order ?
|
4) Write a program to insert elements into linked list at first and last position?
|
5) Write a program to iterate through all elements in a linked list starting at the specified position ?
|
6) Write a program that swaps two elements in linked list ?
|
5) Write a program that shuffle the elements in linked list ?
|
6) Write a program to join two linked list ?
|
7) Write a program to clone an linked list into another linked list ?
|
8) Write a program to compare two linked list ?
|
9) Write a program to check linked list is empty or not ?
|
HashSet |
1) Write a program to append the specified element to the end of a hash set ?
|
2) Write a program to get the number of elements in a hash set and empty a hash set?
|
3) Write a program to test if hash set is empty or not ?
|
4) Write a program to clone a hash set to another hash set ?
|
5) Write a program to convert a hash set to a List/ArrayList ?
|
6) Write a program to compare two sets and retain elements which are same on both sets ?
|
HashMap |
1) Write a program to count the number of key-value (size) mappings in a map ?
|
2) Write a program to copy all mappings from the specified map to another map ?
|
3) Write a program to remove all mappings from a map contains key-value mappings (empty) or not ?
|
4) Write a program to get a shallow copy of hashmap instance ?
|
5) Write a program to get the value of a specified key in a map ?
|
6) Write a program to compare two sets and retain elements which are same on both sets ?
|