aQute.libg.generics.Create Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.aries.spifly.dynamic.framework.extension Show documentation
Show all versions of org.apache.aries.spifly.dynamic.framework.extension Show documentation
This framework extension fragment contains an extender that facilitates
the use of JRE SPI providers (components typically plugged in to the
JRE through META-INF/services resources).
package aQute.libg.generics;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class Create {
public static Map map() {
return new LinkedHashMap<>();
}
public static Map map(Class key, Class value) {
return Collections.checkedMap(new LinkedHashMap<>(), key, value);
}
public static List list() {
return new ArrayList<>();
}
public static List list(Class c) {
return Collections.checkedList(new ArrayList<>(), c);
}
public static Set set() {
return new LinkedHashSet<>();
}
public static Set set(Class c) {
return Collections.checkedSet(new LinkedHashSet<>(), c);
}
@SafeVarargs
public static List list(T... source) {
return new ArrayList<>(Arrays.asList(source));
}
@SafeVarargs
public static Set set(T... source) {
return new LinkedHashSet<>(Arrays.asList(source));
}
public static Map copy(Map source) {
return new LinkedHashMap<>(source);
}
public static List copy(List source) {
return new ArrayList<>(source);
}
public static Set copy(Collection source) {
if (source == null)
return set();
return new LinkedHashSet<>(source);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy