Last active
March 9, 2023 11:08
-
-
Save adojos/d5e45fc48b7575762bc7c187109c7ad1 to your computer and use it in GitHub Desktop.
Java: Remove Duplicates from List : LinkedHashSet #java
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
public static void usingLinkedHashSet(){ | |
List<Integer> input = Arrays.asList(5,10,15,20,10,5,35,40,10,25); | |
Set<Integer> output = new LinkedHashSet<Integer>(input); | |
for(Integer num:output){ | |
System.out.print(num+" "); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment