autofixture.implementationdetails.CollectionFactory Maven / Gradle / Ivy
package autofixture.implementationdetails;
import com.google.common.reflect.TypeToken;
import java.lang.reflect.Array;
import java.util.*;
import java.util.concurrent.*;
/**
* Created by astral on 07.02.15.
*/
public class CollectionFactory {
public static Map createMapFrom(final T[] keys, final V[] values) {
final Map map = new HashMap<>();
for (int i = 0; i < keys.length; ++i) {
map.put(keys[i], values[i]);
}
return map;
}
public static Deque createDequeFrom(final Collection many) {
return new ArrayDeque<>(many);
}
public static SortedSet createSortedSetFrom(final Collection many) {
return new TreeSet<>(many);
}
public static Set createSetFrom(final Collection many) {
return new HashSet<>(many);
}
public static SortedMap createSortedMapFrom(final Map map) {
return new TreeMap<>(map);
}
public static List createList() {
return new ArrayList<>();
}
public static ArrayList