Given two sets, creates an immutable view set consisting of elements of the two sets. WARNING: this implementation simply treats two sets as one set and does not guarantee the uniqueness of elements. It is responsibility of the client code to guarantee that the elements in set1 and {@cod
(
Set<? extends T> set1, Set<? extends T> set2)
| 285 | * and {@code set2} |
| 286 | */ |
| 287 | public static <T> Set<T> toCombinedSet( |
| 288 | Set<? extends T> set1, Set<? extends T> set2) { |
| 289 | return Collections.unmodifiableSet(new CombinedSetView<>(set1, set2)); |
| 290 | } |
| 291 | |
| 292 | private static class CombinedSetView<T> extends AbstractSet<T> { |
| 293 |
no outgoing calls