|
| 1 | +/* |
| 2 | + * Copyright 2008 Google Inc. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 5 | + * use this file except in compliance with the License. You may obtain a copy of |
| 6 | + * the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | + * License for the specific language governing permissions and limitations under |
| 14 | + * the License. |
| 15 | + */ |
| 16 | +package java.util; |
| 17 | + |
| 18 | +import org.jspecify.nullness.NullMarked; |
| 19 | +import org.jspecify.nullness.Nullable; |
| 20 | + |
| 21 | +// Note: This implementation relies on the fact that Kotlin Native's HashMap is linked. |
| 22 | +/** |
| 23 | + * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html">the official |
| 24 | + * Java API doc</a> for details. |
| 25 | + */ |
| 26 | +@NullMarked |
| 27 | +public class LinkedHashMap<K extends @Nullable Object, V extends @Nullable Object> |
| 28 | + extends HashMap<K, V> implements Map<K, V>, Cloneable { |
| 29 | + |
| 30 | + public LinkedHashMap() { |
| 31 | + super(); |
| 32 | + } |
| 33 | + |
| 34 | + public LinkedHashMap(int initialCapacity) { |
| 35 | + super(initialCapacity); |
| 36 | + } |
| 37 | + |
| 38 | + public LinkedHashMap(int initialCapacity, float loadFactor) { |
| 39 | + super(initialCapacity, loadFactor); |
| 40 | + } |
| 41 | + |
| 42 | + public LinkedHashMap(Map<? extends K, ? extends V> original) { |
| 43 | + super(original); |
| 44 | + } |
| 45 | + |
| 46 | + @Override |
| 47 | + public Object clone() { |
| 48 | + return new LinkedHashMap<K, V>(this); |
| 49 | + } |
| 50 | +} |
0 commit comments