public boolean addAll(Collection<? extends T> coll) { boolean added = false; for (T i: coll) { add(i); added = true; } return added; }
public boolean remove(Object o) { boolean contains = contains(o); map.remove(o); return contains; }
@Override public boolean equals(final Object o) { if ( o == this ) return true; if ( o instanceof Set ) { final Set that = (Set) o; if ( that.size() != this.size() ) return false; try { return containsAll(that); } catch (ClassCastException ignore) { /* return false; */ } } return false; }
/** * Add a new subclass to the weak set of subclasses. * * This version always constructs a new set to avoid having to synchronize * against the set when iterating it for invalidation in * invalidateCacheDescendants. * * @param subclass The subclass to add */ public synchronized void addSubclass(RubyClass subclass) { synchronized (runtime.getHierarchyLock()) { Set<RubyClass> oldSubclasses = subclasses; if (oldSubclasses == null) subclasses = oldSubclasses = new WeakHashSet<RubyClass>(4); oldSubclasses.add(subclass); } }
@Override public String toString() { Iterator<T> it = iterator(); if ( ! it.hasNext() ) return "[]"; StringBuilder sb = new StringBuilder(); sb.append('['); while (true) { final T e = it.next(); sb.append(e == this ? "(this Collection)" : e); if ( ! it.hasNext() ) return sb.append(']').toString(); sb.append(',').append(' '); } }
/** * Add a new subclass to the weak set of subclasses. * * This version always constructs a new set to avoid having to synchronize * against the set when iterating it for invalidation in * invalidateCacheDescendants. * * @param subclass The subclass to add */ public synchronized void addSubclass(RubyClass subclass) { synchronized (runtime.getHierarchyLock()) { Set<RubyClass> oldSubclasses = subclasses; if (oldSubclasses == null) subclasses = oldSubclasses = new WeakHashSet<RubyClass>(4); oldSubclasses.add(subclass); } }
@Override public String toString() { Iterator<T> it = iterator(); if ( ! it.hasNext() ) return "[]"; StringBuilder sb = new StringBuilder(); sb.append('['); while (true) { final T e = it.next(); sb.append(e == this ? "(this Collection)" : e); if ( ! it.hasNext() ) return sb.append(']').toString(); sb.append(',').append(' '); } }
@SuppressWarnings("unchecked") public void addIncludingHierarchy(IncludedModule hierarchy) { synchronized (getRuntime().getHierarchyLock()) { Set<RubyClass> including = this.includingHierarchies; if (including == Collections.EMPTY_SET) { including = this.includingHierarchies = new WeakHashSet(4); } including.add(hierarchy); } }
public boolean addAll(Collection<? extends T> coll) { boolean added = false; for (T i: coll) { add(i); added = true; } return added; }
@Override public boolean equals(final Object o) { if ( o == this ) return true; if ( o instanceof Set ) { final Set that = (Set) o; if ( that.size() != this.size() ) return false; try { return containsAll(that); } catch (ClassCastException ignore) { /* return false; */ } } return false; }
public boolean remove(Object o) { boolean contains = contains(o); map.remove(o); return contains; }
@SuppressWarnings("unchecked") public void addIncludingHierarchy(IncludedModule hierarchy) { synchronized (getRuntime().getHierarchyLock()) { Set<RubyClass> including = this.includingHierarchies; if (including == Collections.EMPTY_SET) { including = this.includingHierarchies = new WeakHashSet(4); } including.add(hierarchy); } }
public boolean addAll(Collection<? extends T> arg0) { boolean added = false; for (T i: arg0) { add(i); added = true; } return added; }
public void addIncludingHierarchy(IncludedModuleWrapper hierarchy) { synchronized (getRuntime().getHierarchyLock()) { Set<RubyClass> oldIncludingHierarchies = includingHierarchies; if (oldIncludingHierarchies == Collections.EMPTY_SET) includingHierarchies = oldIncludingHierarchies = new WeakHashSet(4); oldIncludingHierarchies.add(hierarchy); } }
public boolean addAll(Collection<? extends T> arg0) { boolean added = false; for (T i: arg0) { add(i); added = true; } return added; }
public void addIncludingHierarchy(IncludedModuleWrapper hierarchy) { synchronized (getRuntime().getHierarchyLock()) { Set<RubyClass> oldIncludingHierarchies = includingHierarchies; if (oldIncludingHierarchies == Collections.EMPTY_SET) includingHierarchies = oldIncludingHierarchies = new WeakHashSet(4); oldIncludingHierarchies.add(hierarchy); } }
@Override public WeakHashSet<T> clone() { //WeakHashSet<T> newSet = (WeakHashSet<T>) super.clone(); //newSet.map = (WeakHashMap<T, Object>) map.clone(); WeakHashSet<T> newSet = new WeakHashSet<T>(map.size()); newSet.map.putAll(this.map); return newSet; }
@Override public WeakHashSet<T> clone() { //WeakHashSet<T> newSet = (WeakHashSet<T>) super.clone(); //newSet.map = (WeakHashMap<T, Object>) map.clone(); WeakHashSet<T> newSet = new WeakHashSet<T>(map.size()); newSet.map.putAll(this.map); return newSet; }