@Override public Set<String> create(String[] elements) { Set<String> innerSet = new HashSet<>(); Collections.addAll(innerSet, elements); return Collections.checkedSet(innerSet, String.class); } })
classes.add(Collections.checkedNavigableSet(Collections.emptyNavigableSet(), Void.class).getClass()); classes.add(Collections.checkedQueue(new LinkedList<>(), Void.class).getClass()); classes.add(Collections.checkedSet(Collections.emptySet(), Void.class).getClass()); classes.add(Collections.checkedSortedMap(Collections.emptySortedMap(), Void.class, Void.class).getClass()); classes.add(Collections.checkedSortedSet(Collections.emptySortedSet(), Void.class).getClass());
checkedSet = Collections.checkedSet(es, Size.class); checkedSortedSet = Collections.checkedSortedSet(ts, String.class); checkedList = Collections.checkedList(ll, String.class);
@SuppressWarnings("unchecked") public Set<Point> getElements() { //return (Set<Point>) super.elements; return Collections.checkedSet( (Set<Point>) super.elements, Point.class ); }
@SuppressWarnings("unchecked") public Set<? extends Primitive> getElements() { return Collections.checkedSet( (Set<Primitive>) super.elements, Primitive.class ); } }
@Override public Dollar.SetWrapper<T> checked(Class<T> requiredClass) { set = Collections.checkedSet(set, requiredClass); return this; }
@SuppressWarnings("unchecked") public Set<OrientableSurface> getElements() { //return (Set<OrientableSurface>) super.elements; return Collections.checkedSet( (Set<OrientableSurface>) super.elements, OrientableSurface.class ); }
@SuppressWarnings("unchecked") public Set<OrientableCurve> getElements() { return (Set<OrientableCurve>) Collections.checkedSet( (Set<OrientableCurve>) elements, OrientableCurve.class ); }
public Set<PropertyChangeListener> getPropertyChangeListeners() { return Collections.checkedSet(listeners, PropertyChangeListener.class); }
public static <T> Set<T> set(Class<T> c) { return Collections.checkedSet(new LinkedHashSet<>(), c); }
public static <T> Set<T> set(Class<T> c) { return Collections.checkedSet(new LinkedHashSet<T>(), c); }
public static <T> Set<T> set(Class<T> c) { return Collections.checkedSet(new HashSet<T>(), c); }
public static <T> Set<T> set(Class<T> c) { return Collections.checkedSet(new LinkedHashSet<>(), c); }
public static <T> Set<T> set(Class<T> c) { return Collections.checkedSet(new HashSet<T>(), c); }
public static <T> Set<T> set(Class<T> c) { return Collections.checkedSet(new LinkedHashSet<>(), c); }
@Override public Set<String> create(String[] elements) { Set<String> innerSet = new HashSet<>(); Collections.addAll(innerSet, elements); return Collections.checkedSet(innerSet, String.class); } })
@Override public Set<String> create(String[] elements) { Set<String> innerSet = new HashSet<String>(); Collections.addAll(innerSet, elements); return Collections.checkedSet(innerSet, String.class); } })
/** Create a checked Set<String>, first verifying that all elements are in fact String. @param s the Set @throws ClassCastException */ public static <T> Set<T> checkedSet(final Set<?> s, final Class<T> theClass) { final Set<T> cs = checkSet(s, theClass); return Collections.checkedSet(cs, theClass); }
/** Create a checked Set<String>, first verifying that all elements are in fact String. @param s the Set @throws ClassCastException */ public static <T> Set<T> checkedSet(final Set<?> s, final Class<T> theClass) { final Set<T> cs = checkSet(s, theClass); return Collections.checkedSet(cs, theClass); }
static ImmutableMap<ParcelDTO, DefaultParcel> contentsToMap(PDPModel pm, DefaultVehicle vehicle) { // this is ok since we actually check the type @SuppressWarnings({ "unchecked", "rawtypes" }) final Set<DefaultParcel> ps = Collections.checkedSet( (Set) newLinkedHashSet(pm.getContents(vehicle)), DefaultParcel.class); return toMap(ps); }