src/share/classes/javax/imageio/metadata/IIOMetadataNode.java
Print this page
rev 9293 : 8034998: Fix raw and unchecked lint warnings in javax.imageio
Reviewed-by:
@@ -48,34 +48,34 @@
}
}
class IIONamedNodeMap implements NamedNodeMap {
- List nodes;
+ List<? extends Node> nodes;
- public IIONamedNodeMap(List nodes) {
+ public IIONamedNodeMap(List<? extends Node> nodes) {
this.nodes = nodes;
}
public int getLength() {
return nodes.size();
}
public Node getNamedItem(String name) {
- Iterator iter = nodes.iterator();
+ Iterator<? extends Node> iter = nodes.iterator();
while (iter.hasNext()) {
- Node node = (Node)iter.next();
+ Node node = iter.next();
if (name.equals(node.getNodeName())) {
return node;
}
}
return null;
}
public Node item(int index) {
- Node node = (Node)nodes.get(index);
+ Node node = nodes.get(index);
return node;
}
public Node removeNamedItem(java.lang.String name) {
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
@@ -109,13 +109,13 @@
}
}
class IIONodeList implements NodeList {
- List nodes;
+ List<? extends Node> nodes;
- public IIONodeList(List nodes) {
+ public IIONodeList(List<? extends Node> nodes) {
this.nodes = nodes;
}
public int getLength() {
return nodes.size();
@@ -123,11 +123,11 @@
public Node item(int index) {
if (index < 0 || index > nodes.size()) {
return null;
}
- return (Node)nodes.get(index);
+ return nodes.get(index);
}
}
class IIOAttr extends IIOMetadataNode implements Attr {
@@ -283,11 +283,11 @@
/**
* A <code>List</code> of <code>IIOAttr</code> nodes representing
* attributes.
*/
- private List attributes = new ArrayList();
+ private List<IIOAttr> attributes = new ArrayList<>();
/**
* Constructs an empty <code>IIOMetadataNode</code>.
*/
public IIOMetadataNode() {}
@@ -787,11 +787,11 @@
}
private void removeAttribute(String name, boolean checkPresent) {
int numAttributes = attributes.size();
for (int i = 0; i < numAttributes; i++) {
- IIOAttr attr = (IIOAttr)attributes.get(i);
+ IIOAttr attr = attributes.get(i);
if (name.equals(attr.getName())) {
attr.setOwnerElement(null);
attributes.remove(i);
return;
}
@@ -871,16 +871,16 @@
removeAttribute(oldAttr.getName());
return oldAttr;
}
public NodeList getElementsByTagName(String name) {
- List l = new ArrayList();
+ List<Node> l = new ArrayList<>();
getElementsByTagName(name, l);
return new IIONodeList(l);
}
- private void getElementsByTagName(String name, List l) {
+ private void getElementsByTagName(String name, List<Node> l) {
if (nodeName.equals(name)) {
l.add(this);
}
Node child = getFirstChild();