jetbrick-commons/src/main/java/jetbrick/collections/SoftHashMap.java
@Override
    public Set<Entry<K, V>> entrySet() {
        processQueue();
        Set<Entry<K, V>> result = new LinkedHashSet<Entry<K, V>>();
        for (final Entry<K, SoftValue<V>> entry : map.entrySet()) {
            final V value = entry.getValue().get();
            if (value != null) {
                result.add(new Entry<K, V>() {
                    @Override
                    public K getKey() {
                        return entry.getKey();
                    }

                    @Override
                    public V getValue() {
                        return value;
                    }

                    @Override
                    public V setValue(V v) {
                        entry.setValue(new SoftValue<V>(v, entry.getKey(), queue));
                        return value;
                    }
                });
            }
        }
        return result;
    }
@Override
    public Set<Entry<K, V>> entrySet() {
        processQueue();
        Set<Entry<K, V>> result = new LinkedHashSet<Entry<K, V>>();
        for (final Entry<K, SoftValue<V>> entry : map.entrySet()) {
            final V value = entry.getValue().get();
            if (value != null) {
                result.add(new Entry<K, V>() {
                    @Override
                    public K getKey() {
                        return entry.getKey();
                    }

                    @Override
                    public V getValue() {
                        return value;
                    }

                    @Override
                    public V setValue(V v) {
                        entry.setValue(new SoftValue<V>(v, entry.getKey(), queue));
                        return value;
                    }
                });
            }
        }
        return result;
    }
@ Override public Set < Entry < K , V > > entrySet ( ) { processQueue ( ) ; Set < Entry < K , V > > result = new LinkedHashSet < Entry < K , V > > ( ) ; for ( final Entry < K , SoftValue < V > > entry : map . entrySet ( ) ) { final V value = entry . getValue ( ) . get ( ) ; if ( value != null ) { result . add ( new Entry < K , V > ( ) { @ Override public K getKey ( ) { return entry . getKey ( ) ; } @ Override public V getValue ( ) { return value ; } @ Override public V setValue ( V v ) { entry . setValue ( new SoftValue < V > ( v , entry . getKey ( ) , queue ) ) ; return value ; } } ) ; } } return result ; }
Returns a copy of the key/values in the map at the point of
calling.  However, setValue still sets the value in the
actual SoftHashMap.
Returns a copy of the key / values in the map at the point of calling . However setValue still sets the value in the actual SoftHashMap .