Task 6b - ArrayList

Make a class User with only id and name. Define a constructor that take at least id.

Make an ArrayList of User, and perform following operations:

  1. Add few User objects into it
  2. Replace object at index i with a new object 
  3. Add new object at specific index
  4. Print size of list after each operation
  5. Remove an object from list by index
  6. Remove an object by passing object reference
  7. Convert the list into an Array and print the Array elements
  8. Define a method that receives the list and print its all elements (id and name attribute)
  9. Call above method after each operation listed above
  10. Create a sublist from index 3 to 5 (I assume there are at least 6 objects in your list)
  11. Make a new list with 3 objects, and add the new list elements into already defined list

Comments