Stuart McCulloch | d00f971 | 2009-07-13 10:06:47 +0000 | [diff] [blame] | 1 | package aQute.libg.generics; |
| 2 | |
| 3 | import java.util.*; |
| 4 | |
| 5 | public class Create { |
| 6 | |
| 7 | public static <K,V> Map<K, V> map() { |
| 8 | return new LinkedHashMap<K,V>(); |
| 9 | } |
| 10 | |
| 11 | public static <T> List<T> list() { |
| 12 | return new ArrayList<T>(); |
| 13 | } |
| 14 | |
| 15 | public static <T> Set<T> set() { |
| 16 | return new HashSet<T>(); |
| 17 | } |
| 18 | |
| 19 | public static <T> List<T> list(T[] source) { |
| 20 | return new ArrayList<T>(Arrays.asList(source)); |
| 21 | } |
| 22 | |
| 23 | public static <T> Set<T> set(T[]source) { |
| 24 | return new HashSet<T>(Arrays.asList(source)); |
| 25 | } |
| 26 | |
| 27 | public static <K,V> Map<K, V> copy(Map<K,V> source) { |
| 28 | return new LinkedHashMap<K,V>(source); |
| 29 | } |
| 30 | |
| 31 | public static <T> List<T> copy(List<T> source) { |
| 32 | return new ArrayList<T>(source); |
| 33 | } |
| 34 | |
| 35 | public static <T> Set<T> copy(Set<T> source) { |
| 36 | return new HashSet<T>(source); |
| 37 | } |
| 38 | |
| 39 | |
| 40 | } |