/** Returns a {@link Set} view of the keys contained in this map. The set * is backed by the map, so changes to the map are reflected in the set, * and vice-versa. The set supports element removal, which removes the * corresponding mapping from this map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt>, and * <tt>clear</tt> operations. It does not support the <tt>add</tt> or * <tt>addAll</tt> operations. * * <p>The view's <tt>iterator</tt> is a "weakly consistent" iterator that * will never throw {@link ConcurrentModificationException}, and guarantees * to traverse elements as they existed upon construction of the iterator, * and may (but is not guaranteed to) reflect any modifications subsequent * to construction. */ public Set<TypeK> keySet() { return new AbstractSet<TypeK> () { @Override public void clear ( ) { NonBlockingHashtable.this.clear ( ); } @Override public int size ( ) { return NonBlockingHashtable.this.size ( ); } @Override public boolean contains( Object k ) { return NonBlockingHashtable.this.containsKey(k); } @Override public boolean remove ( Object k ) { return NonBlockingHashtable.this.remove (k) != null; } @Override public Iterator<TypeK> iterator() { return new SnapshotK(); } }; }
/** Returns a {@link Set} view of the keys contained in this map. The set * is backed by the map, so changes to the map are reflected in the set, * and vice-versa. The set supports element removal, which removes the * corresponding mapping from this map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt>, and * <tt>clear</tt> operations. It does not support the <tt>add</tt> or * <tt>addAll</tt> operations. * * <p>The view's <tt>iterator</tt> is a "weakly consistent" iterator that * will never throw {@link ConcurrentModificationException}, and guarantees * to traverse elements as they existed upon construction of the iterator, * and may (but is not guaranteed to) reflect any modifications subsequent * to construction. */ public Set<TypeK> keySet() { return new AbstractSet<TypeK> () { @Override public void clear ( ) { NonBlockingHashtable.this.clear ( ); } @Override public int size ( ) { return NonBlockingHashtable.this.size ( ); } @Override public boolean contains( Object k ) { return NonBlockingHashtable.this.containsKey(k); } @Override public boolean remove ( Object k ) { return NonBlockingHashtable.this.remove (k) != null; } @Override public Iterator<TypeK> iterator() { return new SnapshotK(); } }; }
/** Returns a {@link Set} view of the keys contained in this map. The set * is backed by the map, so changes to the map are reflected in the set, * and vice-versa. The set supports element removal, which removes the * corresponding mapping from this map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt>, and * <tt>clear</tt> operations. It does not support the <tt>add</tt> or * <tt>addAll</tt> operations. * * <p>The view's <tt>iterator</tt> is a "weakly consistent" iterator that * will never throw {@link ConcurrentModificationException}, and guarantees * to traverse elements as they existed upon construction of the iterator, * and may (but is not guaranteed to) reflect any modifications subsequent * to construction. */ public Set<TypeK> keySet() { return new AbstractSet<TypeK> () { @Override public void clear ( ) { NonBlockingHashtable.this.clear ( ); } @Override public int size ( ) { return NonBlockingHashtable.this.size ( ); } @Override public boolean contains( Object k ) { return NonBlockingHashtable.this.containsKey(k); } @Override public boolean remove ( Object k ) { return NonBlockingHashtable.this.remove (k) != null; } @Override public Iterator<TypeK> iterator() { return new SnapshotK(); } }; }
@Override public Iterator<TypeK> iterator() { return new SnapshotK(); } };
@Override public Iterator<TypeK> iterator() { return new SnapshotK(); } };
@Override public Iterator<TypeK> iterator() { return new SnapshotK(); } };
/** Returns an enumeration of the keys in this table. * @return an enumeration of the keys in this table * @see #keySet() */ public Enumeration<TypeK> keys() { return new SnapshotK(); }
/** Returns an enumeration of the keys in this table. * @return an enumeration of the keys in this table * @see #keySet() */ public Enumeration<TypeK> keys() { return new SnapshotK(); }
/** Returns an enumeration of the keys in this table. * @return an enumeration of the keys in this table * @see #keySet() */ public Enumeration<TypeK> keys() { return new SnapshotK(); }