/ Published in: Java
This is a collection of useful static initializers of Java arrays, lists and maps.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public class CollectionInitUtils { public static <T> T[] ar(final T... ts) { return ts; } public static <T> Set<T> set(final T... ts) { } public static <K, V> Map<K, V> zipMap(final K[] keys, final V[] values) { final Map<K, V> res = new HashMap<K, V>(); for (int i = 0; i < keys.length; i++) { res.put(keys[i], values[i]); } return res; } }