equal
deleted
inserted
replaced
26 package java.util.jar; |
26 package java.util.jar; |
27 |
27 |
28 import java.io.DataInputStream; |
28 import java.io.DataInputStream; |
29 import java.io.DataOutputStream; |
29 import java.io.DataOutputStream; |
30 import java.io.IOException; |
30 import java.io.IOException; |
31 import java.util.HashMap; |
31 import java.util.LinkedHashMap; |
32 import java.util.Map; |
32 import java.util.Map; |
33 import java.util.Set; |
33 import java.util.Set; |
34 import java.util.Collection; |
34 import java.util.Collection; |
35 import java.util.AbstractSet; |
35 import java.util.AbstractSet; |
36 import java.util.Iterator; |
36 import java.util.Iterator; |
45 * characters in length. Attribute values can contain any characters and |
45 * characters in length. Attribute values can contain any characters and |
46 * will be UTF8-encoded when written to the output stream. See the |
46 * will be UTF8-encoded when written to the output stream. See the |
47 * <a href="../../../../technotes/guides/jar/jar.html">JAR File Specification</a> |
47 * <a href="../../../../technotes/guides/jar/jar.html">JAR File Specification</a> |
48 * for more information about valid attribute names and values. |
48 * for more information about valid attribute names and values. |
49 * |
49 * |
|
50 * <p>This map and its views have a predictable iteration order, namely the |
|
51 * order that keys were inserted into the map, as with {@link LinkedHashMap}. |
|
52 * |
50 * @author David Connelly |
53 * @author David Connelly |
51 * @see Manifest |
54 * @see Manifest |
52 * @since 1.2 |
55 * @since 1.2 |
53 */ |
56 */ |
54 public class Attributes implements Map<Object,Object>, Cloneable { |
57 public class Attributes implements Map<Object,Object>, Cloneable { |
69 * initial size. |
72 * initial size. |
70 * |
73 * |
71 * @param size the initial number of attributes |
74 * @param size the initial number of attributes |
72 */ |
75 */ |
73 public Attributes(int size) { |
76 public Attributes(int size) { |
74 map = new HashMap<>(size); |
77 map = new LinkedHashMap<>(size); |
75 } |
78 } |
76 |
79 |
77 /** |
80 /** |
78 * Constructs a new Attributes object with the same attribute name-value |
81 * Constructs a new Attributes object with the same attribute name-value |
79 * mappings as in the specified Attributes. |
82 * mappings as in the specified Attributes. |
80 * |
83 * |
81 * @param attr the specified Attributes |
84 * @param attr the specified Attributes |
82 */ |
85 */ |
83 public Attributes(Attributes attr) { |
86 public Attributes(Attributes attr) { |
84 map = new HashMap<>(attr); |
87 map = new LinkedHashMap<>(attr); |
85 } |
88 } |
86 |
89 |
87 |
90 |
88 /** |
91 /** |
89 * Returns the value of the specified attribute name, or null if the |
92 * Returns the value of the specified attribute name, or null if the |