Code example for Collection

Methods: iterator

0
        return !iterator().hasNext();
    } 
 
    public Iterator<T> iterator() {
        return new Iterator<T>() {
            Iterator<WeakReference<T>> it = collection.iterator();
            Object value = NO_VALUE;
 
            @Override 
            public boolean hasNext() { 
                Object value = this.value;
                if (value != null && value != NO_VALUE) {
                    return true; 
                } 
 
                Iterator<WeakReference<T>> it = this.it;
                value = null;
 
                while (it.hasNext()) {
                    WeakReference<T> ref = it.next();
                    value = ref.get();