MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / entrySet

Method entrySet

vm/JavaAPI/src/java/util/Hashtable.java:379–422  ·  view source on GitHub ↗

Returns a set of the mappings contained in this Hashtable. Each element in the set is a Map.Entry. The set is backed by this Hashtable so changes to one are reflected by the other. The set does not support adding. @return a set of the mappings.

()

Source from the content-addressed store, hash-verified

377 * @return a set of the mappings.
378 */
379 public Set<Map.Entry<K, V>> entrySet() {
380 return new Collections.SynchronizedSet<Map.Entry<K, V>>(
381 new AbstractSet<Map.Entry<K, V>>() {
382 @Override
383 public int size() {
384 return elementCount;
385 }
386
387 @Override
388 public void clear() {
389 Hashtable.this.clear();
390 }
391
392 @Override
393 @SuppressWarnings("unchecked")
394 public boolean remove(Object object) {
395 if (contains(object)) {
396 Hashtable.this.remove(((Map.Entry<K, V>) object)
397 .getKey());
398 return true;
399 }
400 return false;
401 }
402
403 @Override
404 @SuppressWarnings("unchecked")
405 public boolean contains(Object object) {
406 Entry<K, V> entry = getEntry(((Map.Entry<K, V>) object)
407 .getKey());
408 return object.equals(entry);
409 }
410
411 @Override
412 public Iterator<Map.Entry<K, V>> iterator() {
413 return new HashIterator<Map.Entry<K, V>>(
414 new MapEntry.Type<Map.Entry<K, V>, K, V>() {
415 public Map.Entry<K, V> get(
416 MapEntry<K, V> entry) {
417 return entry;
418 }
419 });
420 }
421 }, this);
422 }
423
424 /**
425 * Compares this {@code Hashtable} with the specified object and indicates

Callers 3

equalsMethod · 0.95
hashCodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected