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

Method get

vm/JavaAPI/src/java/util/LinkedHashMap.java:306–334  ·  view source on GitHub ↗

Returns the value of the mapping with the specified key. @param key the key. @return the value of the mapping with the specified key, or null if no mapping for the specified key is found.

(Object key)

Source from the content-addressed store, hash-verified

304 * if no mapping for the specified key is found.
305 */
306 @Override
307 public V get(Object key) {
308 LinkedHashMapEntry<K, V> m;
309 if (key == null) {
310 m = (LinkedHashMapEntry<K, V>) findNullKeyEntry();
311 } else {
312 int hash = key.hashCode();
313 int index = (hash & 0x7FFFFFFF) % elementData.length;
314 m = (LinkedHashMapEntry<K, V>) findNonNullKeyEntry(key, index, hash);
315 }
316 if (m == null) {
317 return null;
318 }
319 if (accessOrder && tail != m) {
320 LinkedHashMapEntry<K, V> p = m.chainBackward;
321 LinkedHashMapEntry<K, V> n = m.chainForward;
322 n.chainBackward = p;
323 if (p != null) {
324 p.chainForward = n;
325 } else {
326 head = n;
327 }
328 m.chainForward = null;
329 m.chainBackward = tail;
330 tail.chainForward = m;
331 tail = m;
332 }
333 return m.value;
334 }
335
336 /*
337 * @param key @param index @return Entry

Calls 3

hashCodeMethod · 0.65
findNullKeyEntryMethod · 0.45
findNonNullKeyEntryMethod · 0.45