* @return A new set for elements of the given type.
*/
@SuppressWarnings({"unchecked","rawtypes"})
public static <E> Set<E> createSetForType(final Class<E> type, final int count) {
if (CodeList.class.isAssignableFrom(type)) {
return new CodeListSet((Class) type);
}
if (Enum.class.isAssignableFrom(type)) {
return EnumSet.noneOf((Class) type);
}
return new LinkedHashSet<E>(hashMapCapacity(count));