Deleted for privacy.
Printable View
Deleted for privacy.
Have you read about java.util.Set?, take a look then refactor your code.
Ok, so what is wrong with this process:
1. Combine the two ArrayLists using ArrayList.addAll(Collection<? extends E> c)
2. Go through the new ArrayList and remove all duplicates. This can be done in two ways:
A) (Standard Way) Embedded For loops where the first For loop goes through the entire ArrayList to get an Object, and the second For loop goes through the ArrayList again seeing if that Object is found in another place in the ArrayList.
B) (Fun Way) For Loop that goes through entire ArrayList. For each instance, use the AbstractList.lastIndexOf(Object o) method. If the returned index is not equal to current index, remove the object in the returned index and check for the current object in the ArrayList again. Once the returned index is equal to the current index, you know that Object is not repeated in the ArrayList anymore.