src/share/classes/com/sun/jndi/dns/NameNode.java
Print this page
@@ -50,11 +50,11 @@
class NameNode {
private String label; // name of this node relative to its
// parent, or null for root of a tree
- private Hashtable children = null; // child nodes
+ private Hashtable<String,NameNode> children = null; // child nodes
private boolean isZoneCut = false; // true if this node is a zone cut
private int depth = 0; // depth in tree (0 for root)
NameNode(String label) {
this.label = label;
@@ -95,22 +95,22 @@
/*
* Returns the children of this node, or null if there are none.
* The caller must not modify the Hashtable returned.
*/
- Hashtable getChildren() {
+ Hashtable<String,NameNode> getChildren() {
return children;
}
/*
* Returns the child node given the hash key (the down-cased label)
* for its name relative to this node, or null if there is no such
* child.
*/
NameNode get(String key) {
return (children != null)
- ? (NameNode) children.get(key)
+ ? children.get(key)
: null;
}
/*
* Returns the node at the end of a path, or null if the
@@ -138,13 +138,13 @@
String label = name.get(i);
String key = name.getKey(i);
NameNode child = null;
if (node.children == null) {
- node.children = new Hashtable();
+ node.children = new Hashtable<>();
} else {
- child = (NameNode) node.children.get(key);
+ child = node.children.get(key);
}
if (child == null) {
child = newNameNode(label);
child.depth = node.depth + 1;
node.children.put(key, child);