how to remove a duplicate item from an arraylist in ajva code example
Example 1: remove duplicates from list java
ArrayList<Object> withDuplicateValues;
HashSet<Object> withUniqueValue = new HashSet<>(withDuplicateValues);
withDuplicateValues.clear();
withDuplicateValues.addAll(withUniqueValue);
Example 2: remove duplicates from list java
Set<String> set = new HashSet<>(yourList);
yourList.clear();
yourList.addAll(set);