CollectionUtils { @SafeVarargs public static <T> List<T> listOf(Collection<? extends T>... collections) { List<T> list = new ArrayList<>(); for (Collection<? extends T> collection : collections) { list.addAll(collection); } return list; } private  CollectionUtils(); @SafeVarargs static List<T> listOf(Collection<? extends T>... collections);  }
@Test void testListOf() { List<String> list = CollectionUtils.listOf(Sets.newHashSet("a"), Sets.newHashSet("b")); Assertions.assertAll( () -> Assertions.assertEquals(2, list.size()), () -> Assertions.assertTrue(list.contains("a")), () -> Assertions.assertTrue(list.contains("b")) ); }