src/share/classes/javax/print/attribute/HashAttributeSet.java
Print this page
@@ -46,17 +46,17 @@
* The interface of which all members of this attribute set must be an
* instance. It is assumed to be interface {@link Attribute Attribute}
* or a subinterface thereof.
* @serial
*/
- private Class myInterface;
+ private Class<?> myInterface;
/*
* A HashMap used by the implementation.
* The serialised form doesn't include this instance variable.
*/
- private transient HashMap attrMap = new HashMap();
+ private transient HashMap<Class<?>, Attribute> attrMap = new HashMap<>();
/**
* Write the instance to a stream (ie serialize the object)
*
* @serialData
@@ -80,11 +80,11 @@
*/
private void readObject(ObjectInputStream s)
throws ClassNotFoundException, IOException {
s.defaultReadObject();
- attrMap = new HashMap();
+ attrMap = new HashMap<>();
int count = s.readInt();
Attribute attr;
for (int i = 0; i < count; i++) {
attr = (Attribute)s.readObject();
add(attr);
@@ -272,12 +272,11 @@
* (unchecked exception) Thrown if the <CODE>category</CODE> is not a
* {@link java.lang.Class Class} that implements interface {@link
* Attribute Attribute}.
*/
public Attribute get(Class<?> category) {
- return (Attribute)
- attrMap.get(AttributeSetUtilities.
+ return attrMap.get(AttributeSetUtilities.
verifyAttributeCategory(category,
Attribute.class));
}
/**