Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.google.common.collect.*;
- import java.util.*;
- class Example {
- public static void main(String[] args) {
- Set<String> a = Collections.newSetFromMap(new IdentityHashMap<>());
- Set<String> b = new HashSet<>();
- a.add("X");
- b.add(new String("X"));
- System.out.println(Sets.union(a, b)); // [X, X]
- System.out.println(Sets.union(b, a)); // [X]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment