I wanted to create a list of options for testing purposes. At first, I did this:
ArrayList places = new ArrayList();
places.add(\
Here is code by AbacusUtil
// ArrayList
List list = N.asList("Buenos Aires", "Córdoba", "La Plata");
// HashSet
Set set = N.asSet("Buenos Aires", "Córdoba", "La Plata");
// HashMap
Map map = N.asMap("Buenos Aires", 1, "Córdoba", 2, "La Plata", 3);
// Or for Immutable List/Set/Map
ImmutableList.of("Buenos Aires", "Córdoba", "La Plata");
ImmutableSet.of("Buenos Aires", "Córdoba", "La Plata");
ImmutableSet.of("Buenos Aires", 1, "Córdoba", 2, "La Plata", 3);
// The most efficient way, which is similar with Arrays.asList(...) in JDK.
// but returns a flexible-size list backed by the specified array.
List set = Array.asList("Buenos Aires", "Córdoba", "La Plata");
Declaration: I'm the developer of AbacusUtil.