/** * Factory method to create a set from a map. * * @param <E> the element type * @param <V> the dummy value type in the map * @param map the map to decorate, must not be null * @return a new map backed set * @throws NullPointerException if map is null * @since 4.0 */ public static <E, V> MapBackedSet<E, V> mapBackedSet(final Map<E, ? super V> map) { return mapBackedSet(map, null); }
/** * Factory method to create a set from a map. * * @param <E> the element type * @param <V> the dummy value type in the map * @param map the map to decorate, must not be null * @param dummyValue the dummy value to use * @return a new map backed set * @throws NullPointerException if map is null * @since 4.0 */ public static <E, V> MapBackedSet<E, V> mapBackedSet(final Map<E, ? super V> map, final V dummyValue) { return new MapBackedSet<>(map, dummyValue); }