java remove repeating numbers from list 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);