< prev index next >

src/java.base/share/classes/java/util/LinkedHashMap.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 534,563 **** keySet = ks; } return ks; } - @Override - final <T> T[] keysToArray(T[] a) { - Object[] r = a; - int idx = 0; - for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) { - r[idx++] = e.key; - } - return a; - } - - @Override - final <T> T[] valuesToArray(T[] a) { - Object[] r = a; - int idx = 0; - for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) { - r[idx++] = e.value; - } - return a; - } - final class LinkedKeySet extends AbstractSet<K> { public final int size() { return size; } public final void clear() { LinkedHashMap.this.clear(); } public final Iterator<K> iterator() { return new LinkedKeyIterator(); --- 534,543 ----
*** 569,587 **** public final Spliterator<K> spliterator() { return Spliterators.spliterator(this, Spliterator.SIZED | Spliterator.ORDERED | Spliterator.DISTINCT); } - - public Object[] toArray() { - return keysToArray(new Object[size]); - } - - public <T> T[] toArray(T[] a) { - return keysToArray(prepareArray(a)); - } - public final void forEach(Consumer<? super K> action) { if (action == null) throw new NullPointerException(); int mc = modCount; for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) --- 549,558 ----
*** 627,645 **** public final boolean contains(Object o) { return containsValue(o); } public final Spliterator<V> spliterator() { return Spliterators.spliterator(this, Spliterator.SIZED | Spliterator.ORDERED); } - - public Object[] toArray() { - return valuesToArray(new Object[size]); - } - - public <T> T[] toArray(T[] a) { - return valuesToArray(prepareArray(a)); - } - public final void forEach(Consumer<? super V> action) { if (action == null) throw new NullPointerException(); int mc = modCount; for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) --- 598,607 ----
< prev index next >