diff --git a/src/main/java/org/stfm/texdoclet/ClassHierachy.java b/src/main/java/org/stfm/texdoclet/ClassHierachy.java index 37601e9..2370583 100755 --- a/src/main/java/org/stfm/texdoclet/ClassHierachy.java +++ b/src/main/java/org/stfm/texdoclet/ClassHierachy.java @@ -18,7 +18,7 @@ import com.sun.javadoc.RootDoc; */ public class ClassHierachy extends java.lang.Object { - public SortedMap root = new TreeMap(); + public SortedMap root = new TreeMap<>(); /** * Creates new ClassHierachy @@ -29,17 +29,17 @@ public class ClassHierachy extends java.lang.Object { /** * Adds another class to the hierachy */ - protected SortedMap add(ClassDoc cls) { - SortedMap temp; + protected SortedMap add(ClassDoc cls) { + SortedMap temp; if (cls.superclass() != null) { temp = add(cls.superclass()); } else { temp = root; } - SortedMap result = (SortedMap) temp.get(cls.qualifiedName()); + SortedMap result = temp.get(cls.qualifiedName()); if (result == null) { - result = new TreeMap(); + result = new TreeMap(); temp.put(cls.qualifiedName(), result); } return result; diff --git a/src/main/java/org/stfm/texdoclet/InterfaceHierachy.java b/src/main/java/org/stfm/texdoclet/InterfaceHierachy.java index 85709f6..22d1918 100755 --- a/src/main/java/org/stfm/texdoclet/InterfaceHierachy.java +++ b/src/main/java/org/stfm/texdoclet/InterfaceHierachy.java @@ -18,7 +18,7 @@ import com.sun.javadoc.RootDoc; */ public class InterfaceHierachy extends java.lang.Object { - public SortedMap root = new TreeMap(); + public SortedMap root = new TreeMap<>(); /** * Creates new InterfaceHierachy @@ -29,17 +29,17 @@ public class InterfaceHierachy extends java.lang.Object { /** * Adds another interface to the hierachy */ - protected SortedMap add(ClassDoc cls) { - SortedMap temp; + protected SortedMap add(ClassDoc cls) { + SortedMap temp; if (cls.interfaces().length > 0) { temp = add(cls.interfaces()[0]); } else { temp = root; } - SortedMap result = (SortedMap) temp.get(cls.qualifiedName()); + SortedMap result = temp.get(cls.qualifiedName()); if (result == null) { - result = new TreeMap(); + result = new TreeMap<>(); temp.put(cls.qualifiedName(), result); } return result; @@ -57,12 +57,12 @@ public class InterfaceHierachy extends java.lang.Object { * Prints a branch of the tree. The branch is printed using * TeXDoclet.os. */ - protected void printBranch(RootDoc rootDoc, SortedMap map, double indent, + protected void printBranch(RootDoc rootDoc, SortedMap map, double indent, double overviewindent) { - Set set = map.keySet(); - Iterator it = set.iterator(); + Set set = map.keySet(); + Iterator it = set.iterator(); while (it.hasNext()) { - String qualifName = (String) it.next(); + String qualifName = it.next(); ClassDoc cls = rootDoc.classNamed(qualifName); TeXDoclet.os.print("\\hspace{" + Double.toString(indent) + "cm} $\\bullet$ " @@ -71,7 +71,7 @@ public class InterfaceHierachy extends java.lang.Object { TeXDoclet.printRef(cls.containingPackage(), cls.name(), ""); } TeXDoclet.os.println("} \\\\"); - printBranch(rootDoc, (SortedMap) map.get(qualifName), indent + printBranch(rootDoc, map.get(qualifName), indent + overviewindent, overviewindent); } diff --git a/src/main/java/org/stfm/texdoclet/Package.java b/src/main/java/org/stfm/texdoclet/Package.java index 749feb7..b8de2cb 100755 --- a/src/main/java/org/stfm/texdoclet/Package.java +++ b/src/main/java/org/stfm/texdoclet/Package.java @@ -75,12 +75,9 @@ public class Package { * Sorts the vectors of classes, interfaces exceptions and errors. */ public void sort() { - - Comparator comp = new Comparator() { + Comparator comp = new Comparator() { @Override - public int compare(Object o1, Object o2) { - ClassDoc cls1 = (ClassDoc) o1; - ClassDoc cls2 = (ClassDoc) o2; + public int compare(ClassDoc cls1, ClassDoc cls2) { return cls1.name().compareToIgnoreCase(cls2.name()); }