Objectives: In this lab, the following topic will be covered: 1. Generics Task Implement an ordered list capable of hold
Posted: Sat May 14, 2022 3:19 pm
Objectives: In this lab, the following topic will be covered: 1. Generics Task Implement an ordered list capable of holding objects of an arbitrary type, T, by defining a Ordered List class that implements the list with an ArrayList. An ordered list is a type of list where a new item will be added in its correct location to keep the list ordered. Your class should support the following methods: .add(item) - adds an item in its location (do not use the sort method). .toString()-returns the list For example, if list is an ordered list defined to take Integer objects list.add(30); list.add(10); list.add(20); System.out.println(list); // prints [10, 20, 30]