Answered You can hire a professional tutor to get the answer.
// Class ArrayListlt;Egt; can be used to store a list of values of type E. import java.Arrays; import java.Iterator; import...
Submit your version (i.e start with the following file and add your methods) of the generic ArrayList.java with the following 4 additional methods working.
Each of these methods are public (NOT static) and I will test your completed ArrayList.java with something like;
ArrayList<CalendarDate> list = new ArrayList<CalendarDate>();
A. list.reverse(); // page 948 Exercise #4, can work for any data type <E>B. list.count(E); // Exercise #8, where E is the same data type as declared for the list.C. list.mirror(); // Exercise #15, yes this is in Practice-IT, but this exam requires <E>D. list.switchPairs(); // Exercise #21. page 950 in 3rd edition.
Submit only one file: ArrayList.java
I will run my own tests using a static main() as in the past, do not have main() in above file.
Start of code testing:
public static void main(String[] args) { ArrayList<CalendarDate> list = new ArrayList<CalendarDate>(); CalendarDate today = new CalendarDate(2,26); list.reverse(); list.count(today); list.mirror(); list.switchPairs(); System.out.println(list); }
- Attachment 1
- Attachment 2
- Attachment 3
- Attachment 4
- Attachment 5