I have a code that has ArrayList and LinkedList and would like to implement a custom add method class that I can use for both cases.
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(anotherList);
LinkedList<Integer> listTwo = new LinkedList<Integer>();
listTwo.add(newList);
I would like to log for every add method for both LinkedList and ArrayList.
I would have thought implementing Java list interface would be sufficient. Is there a recommended approach of doing this?
I understand there are multiple ways of solving this thing.