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

Method put

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

Associate the specified value with the specified key in this Hashtable. If the key already exists, the old value is replaced. The key and value cannot be null. @param key the key to add. @param value the value to add. @return the old value associated with the specified

(K key, V value)

Source from the content-addressed store, hash-verified

691 * @see java.lang.Object#equals
692 */
693 @Override
694 public synchronized V put(K key, V value) {
695 if (key != null && value != null) {
696 int hash = key.hashCode();
697 int index = (hash & 0x7FFFFFFF) % elementData.length;
698 Entry<K, V> entry = elementData[index];
699 while (entry != null && !entry.equalsKey(key, hash)) {
700 entry = entry.next;
701 }
702 if (entry == null) {
703 modCount++;
704 if (++elementCount > threshold) {
705 rehash();
706 index = (hash & 0x7FFFFFFF) % elementData.length;
707 }
708 if (index < firstSlot) {
709 firstSlot = index;
710 }
711 if (index > lastSlot) {
712 lastSlot = index;
713 }
714 entry = newEntry(key, value, hash);
715 entry.next = elementData[index];
716 elementData[index] = entry;
717 return null;
718 }
719 V result = entry.value;
720 entry.value = value;
721 return result;
722 }
723 throw new NullPointerException();
724 }
725
726 /**
727 * Copies every mapping to this {@code Hashtable} from the specified map.

Callers 15

getContactAsHashtableMethod · 0.95
getAttributesMethod · 0.95
createOauth2Method · 0.95
getParamsFromURLMethod · 0.95
readResponseMethod · 0.95
createOAuthMethod · 0.95
getNewsFeedMethod · 0.95
getWallFeedMethod · 0.95
getWallPostsMethod · 0.95
getAlbumPhotosMethod · 0.95
getUserInboxThreadsMethod · 0.95
searchMethod · 0.95

Calls 4

rehashMethod · 0.95
newEntryMethod · 0.95
hashCodeMethod · 0.65
equalsKeyMethod · 0.45