/** * @since 9.0. */ public static <T> MutableSet<T> adapt(Set<T> list) { return SetAdapter.adapt(list); }
@Override public MutableSet<K> keySet() { return SetAdapter.adapt(this.treeMap.keySet()); }
@Override public MutableSet<K> keySet() { return SetAdapter.adapt(this.treeMap.keySet()); }
@Override public MutableSet<K> keySet() { return SetAdapter.adapt(this.delegate.keySet()); }
@Override public MutableSet<Entry<K, V>> entrySet() { return SetAdapter.adapt(this.treeMap.entrySet()); }
@Override public MutableSet<Entry<K, V>> entrySet() { return SetAdapter.adapt(this.delegate.entrySet()); }
@Override public MutableSet<K> keySet() { return SetAdapter.adapt(this.delegate.keySet()); }
@Override public MutableSet<Entry<K, V>> entrySet() { return SetAdapter.adapt(this.delegate.entrySet()); }
/** * This method will take a MutableSet and wrap it directly in a SynchronizedMutableSet. It will * take any other non-Eclipse-Collections collection and first adapt it will a SetAdapter, and then return a * SynchronizedMutableSet that wraps the adapter. Additionally, a developer specifies which lock to use * with the collection. */ public static <E, S extends Set<E>> SynchronizedMutableSet<E> of(S set, Object lock) { return new SynchronizedMutableSet<>(SetAdapter.adapt(set), lock); }
public static <E> MutableSet<E> wrapSet(Iterable<E> iterable) { if (iterable instanceof MutableSet) { return (MutableSet<E>) iterable; } if (iterable instanceof Set) { return SetAdapter.adapt((Set<E>) iterable); } return UnifiedSet.newSet(iterable); }
public static <E> MutableSet<E> wrapSet(Iterable<E> iterable) { if (iterable instanceof MutableSet) { return (MutableSet<E>) iterable; } if (iterable instanceof Set) { return SetAdapter.adapt((Set<E>) iterable); } return UnifiedSet.newSet(iterable); }
/** * This method will take a MutableSet and wrap it directly in a SynchronizedMutableSet. It will * take any other non-Eclipse-Collections collection and first adapt it will a SetAdapter, and then return a * SynchronizedMutableSet that wraps the adapter. */ public static <E, S extends Set<E>> SynchronizedMutableSet<E> of(S set) { return new SynchronizedMutableSet<>(SetAdapter.adapt(set)); }
/** * This method will take a MutableSet and wrap it directly in a SynchronizedMutableSet. It will * take any other non-Eclipse-Collections collection and first adapt it will a SetAdapter, and then return a * SynchronizedMutableSet that wraps the adapter. Additionally, a developer specifies which lock to use * with the collection. */ public static <E, S extends Set<E>> SynchronizedMutableSet<E> of(S set, Object lock) { return new SynchronizedMutableSet<>(SetAdapter.adapt(set), lock); }
private static <E> MutableSet<E> newSet(Set<? extends E>... sets) { Comparator<? super E> comparator = extractComparator(sets); if (comparator != null) { // TODO: this should return a SortedSetAdapter once implemented return SetAdapter.adapt(new TreeSet<>(comparator)); } return UnifiedSet.newSet(); }
private static <E> MutableSet<E> newSet(Set<? extends E>... sets) { Comparator<? super E> comparator = extractComparator(sets); if (comparator != null) { // TODO: this should return a SortedSetAdapter once implemented return SetAdapter.adapt(new TreeSet<>(comparator)); } return UnifiedSet.newSet(); }
public static <E, R extends Set<E>> R intersectInto( SetIterable<? extends E> setA, SetIterable<? extends E> setB, R targetSet) { MutableSet<E> adapted = SetAdapter.adapt(targetSet); adapted.addAllIterable(setA); adapted.retainAllIterable(setB); return targetSet; }
public static <E, R extends Set<E>> R intersectInto( SetIterable<? extends E> setA, SetIterable<? extends E> setB, R targetSet) { MutableSet<E> adapted = SetAdapter.adapt(targetSet); adapted.addAllIterable(setA); adapted.retainAllIterable(setB); return targetSet; }
public static <E, R extends Set<E>> R differenceInto( SetIterable<? extends E> minuendSet, SetIterable<? extends E> subtrahendSet, R targetSet) { MutableSet<E> adapted = SetAdapter.adapt(targetSet); adapted.addAllIterable(minuendSet); adapted.removeAllIterable(subtrahendSet); return targetSet; }
@Override public MutableSet<T> toSet() { ConcurrentHashMapUnsafe<T, Boolean> map = ConcurrentHashMapUnsafe.newMap(); Set<T> result = Collections.newSetFromMap(map); this.forEach(CollectionAddProcedure.on(result)); return SetAdapter.adapt(map.keySet()); }
@Override public MutableSet<T> toSet() { ConcurrentHashMapUnsafe<T, Boolean> map = ConcurrentHashMapUnsafe.newMap(); Set<T> result = Collections.newSetFromMap(map); this.forEach(CollectionAddProcedure.on(result)); return SetAdapter.adapt(map.keySet()); }