Concatenates two lists and removes duplicate items in the resulting list.
(
List<? extends T> list1, List<? extends T> list2)
| 68 | * Concatenates two lists and removes duplicate items in the resulting list. |
| 69 | */ |
| 70 | public static <T> List<T> concatDistinct( |
| 71 | List<? extends T> list1, List<? extends T> list2) { |
| 72 | Set<T> set = new LinkedHashSet<>(list1); |
| 73 | set.addAll(list2); |
| 74 | return List.copyOf(set); |
| 75 | } |
| 76 | } |