@Test public void unionResultsInSecondListAppendedToFirstListRespectingTheOrder() { final List<Object> list1 = new ArrayList<Object>() {{ add(mockObject1); add(mockObject2); add(mockObject3); add(mockObject4); }}; final List<Object> list2 = new ArrayList<Object>() {{ add(mockObject5); add(mockObject6); }}; final List<Object> result = ListUtils.union(list1, list2); Assertions.assertThat(result).containsExactly(mockObject1, mockObject2, mockObject3, mockObject4, mockObject5, mockObject6); }
@NonNull public static <T> List<T> union(@NonNull final List<T> list1, @NonNull final List<T> list2) { return new ArrayList<T>() {{ addAll(list1); addAll(list2); }}; }
ListUtils { @NonNull public static <T> List<T> union(@NonNull final List<T> list1, @NonNull final List<T> list2) { return new ArrayList<T>() {{ addAll(list1); addAll(list2); }}; } }
ListUtils { @NonNull public static <T> List<T> union(@NonNull final List<T> list1, @NonNull final List<T> list2) { return new ArrayList<T>() {{ addAll(list1); addAll(list2); }}; }  }
ListUtils { @NonNull public static <T> List<T> union(@NonNull final List<T> list1, @NonNull final List<T> list2) { return new ArrayList<T>() {{ addAll(list1); addAll(list2); }}; }  @NonNull static List<T> union(@NonNull final List<T> list1, @NonNull final List<T> list2); static boolean isNotEmpty(@NonNull final List<T> list); }
ListUtils { @NonNull public static <T> List<T> union(@NonNull final List<T> list1, @NonNull final List<T> list2) { return new ArrayList<T>() {{ addAll(list1); addAll(list2); }}; }  @NonNull static List<T> union(@NonNull final List<T> list1, @NonNull final List<T> list2); static boolean isNotEmpty(@NonNull final List<T> list);  }