File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
src/java.base/share/classes/java/util Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 1997, 2019 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 1997, 2020 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
4747 * without incurring the increased cost associated with {@link TreeMap}. It
4848 * can be used to produce a copy of a map that has the same order as the
4949 * original, regardless of the original map's implementation:
50- * <pre>
51- * void foo(Map m) {
52- * Map copy = new LinkedHashMap(m);
50+ * <pre>{@code
51+ * void foo(Map<String, Integer> m) {
52+ * Map<String, Integer> copy = new LinkedHashMap<> (m);
5353 * ...
5454 * }
55- * </pre>
55+ * } </pre>
5656 * This technique is particularly useful if a module takes a map on input,
5757 * copies it, and later returns results whose order is determined by that of
5858 * the copy. (Clients generally appreciate having things returned in the same
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2000, 2019 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2000, 2020 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
4242 * increased cost associated with {@link TreeSet}. It can be used to
4343 * produce a copy of a set that has the same order as the original, regardless
4444 * of the original set's implementation:
45- * <pre>
46- * void foo(Set s) {
47- * Set copy = new LinkedHashSet(s);
45+ * <pre>{@code
46+ * void foo(Set<String> s) {
47+ * Set<String> copy = new LinkedHashSet<> (s);
4848 * ...
4949 * }
50- * </pre>
50+ * } </pre>
5151 * This technique is particularly useful if a module takes a set on input,
5252 * copies it, and later returns results whose order is determined by that of
5353 * the copy. (Clients generally appreciate having things returned in the same
You can’t perform that action at this time.
0 commit comments