You are familiar with ArrayList and have used it in different capacities. The most prominent feature of ArrayList is that it expands automatically as elements are added to it. It can be traversed using a for loop, for each loop and iterator( which you have implemented in Lab 2). In this lab you are going to implement your own ArrayList and its functionalities. Task 1.1: Create a class Generic ArrayList with attributes. Task 1.2: Implement a constructor for your ArrayList class. Task 1.3: Implement add() method for adding elements to ArrayList. Remember, ArrayList adds elements dynamically. It doesn't depend on user defined size. Task 1.4: Implement remove() method for removing an element from a specific index. Remember, ArrayList stores elements in a consecutive sequence. If an element is removed from middle you have to re-adjust the elements in the correct sequence. Note: Break down your implementation by defining helper methods for different tasks, rather than implementing your logic in a single method.
You are familiar with ArrayList and have used it in different capacities. The most prominent feature of ArrayList is that it expands automatically as elements are added to it. It can be traversed using a for loop, for each loop and iterator( which you have implemented in Lab 2).
In this lab you are going to implement your own ArrayList and its functionalities.
Task 1.1: Create a class Generic ArrayList with attributes.
Task 1.2: Implement a constructor for your ArrayList class.
Task 1.3: Implement add() method for adding elements to ArrayList. Remember, ArrayList adds elements dynamically. It doesn't depend on user defined size.
Task 1.4: Implement remove() method for removing an element from a specific index. Remember, ArrayList stores elements in a consecutive sequence. If an element is removed from middle you have to re-adjust the elements in the correct sequence.
Note: Break down your implementation by defining helper methods for different tasks, rather than implementing your logic in a single method.
Step by step
Solved in 5 steps with 3 images