Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
package Collection;
import java.util.*;
public class LinkedHashSetDemo {
public static void main(String args[]){
Set<String> set = new LinkedHashSet<>();
set.add("London");
set.add("Paris");
set.add("İstanbul");
set.add("Ankara");
set.add("London"); // duplicate
for(String s : set)
System.out.print(s.toUpperCase() +" ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment