Created
November 10, 2020 10:58
-
-
Save CeeFeS/04a757fdea4f075144cb566771921b3e to your computer and use it in GitHub Desktop.
clear list from duplicate individual elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private List<?> clearListFromDuplicates(List<?> list1) { | |
Map<String, ?> cleanMap = new LinkedHashMap<String, ?>(); | |
for (int i = 0; i < list1.size(); i++) { | |
cleanMap.put(list1.get(i)./**existing, double element*/, list1.get(i)); | |
} | |
List<?> list = new ArrayList<?>(cleanMap.values()); | |
return list; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment