Code example for ConcurrentMap

Methods: entrySet

0
 
            @Override 
            public Iterator<Map.Entry<K, V>> iterator() {
                return new Iterator<Map.Entry<K, V>>() {
                    private final Iterator<Map.Entry<Key, V>> it = map
                            .entrySet().iterator();
 
                    @Override 
                    public boolean hasNext() { 
                        return it.hasNext();
                    } 
 
                    @Override 
                    public Map.Entry<K, V> next() {
                        return new Map.Entry<K, V>() {
                            private final Map.Entry<Key, V> en = it.next();
 
                            @Override 
                            public K getKey() { 
                                return (K) en.getKey().get();
                            }