Skip to content

Commit 30fa8d5

Browse files
author
Stuart Marks
committedSep 9, 2020
8157729: examples in LinkedHashMap and LinkedHashSet class doc use raw types
Reviewed-by: darcy, naoto, lancea
1 parent 26c7218 commit 30fa8d5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed
 

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
@@ -47,12 +47,12 @@
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

‎src/java.base/share/classes/java/util/LinkedHashSet.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
@@ -42,12 +42,12 @@
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

0 commit comments

Comments
 (0)
Please sign in to comment.