< prev index next >

## src/com/sun/javatest/agent/Map.java

Print this page

    @@ -59,11 +59,11 @@
          * @return The map read from the given file
          * @throws IOException if any errors occurred reading the file
          */
         public static Map readFile(String name) throws IOException {
             try {
    -            Class c = Class.forName("java.io.FileReader"); // optional API in Jersonal Java
    +            Class<?> c = Class.forName("java.io.FileReader"); // optional API in Jersonal Java
                 Constructor m = c.getConstructor(new Class[] {String.class});
                 Reader r = (Reader)(m.newInstance(new Object[] {name}));
                 return new Map(r);
             }
             catch (ClassNotFoundException e) {

    @@ -131,12 +131,12 @@
         public Map(Reader r) throws IOException {
             BufferedReader in =
                 (r instanceof BufferedReader ? (BufferedReader)r : new BufferedReader(r))
     ;
             // data arrives in rows, but we want it in columns
    -        Vector from = new Vector();
    -        Vector to = new Vector();
    +        Vector<String> from = new Vector<>();
    +        Vector<String> to = new Vector<>();
             String line;
             while ((line = in.readLine()) != null) {
                 line = line.trim();
                 if (line.length() > 0  &&  !line.startsWith("#")) {
                     String[] row = StringArray.split(line);

    @@ -201,12 +201,12 @@

         /**
          * Enumerate the entries of the map.
          * @return an enumeration of the translation entries within the map
          */
    -    public Enumeration enumerate() {
    -        Vector v = new Vector(fromValues.length);
    +    public Enumeration<String[]> enumerate() {
    +        Vector<String[]> v = new Vector<>(fromValues.length);
             for (int i = 0; i < fromValues.length; i++) {
                 v.addElement(new String[] {fromValues[i], toValues[i]});
             }
             return v.elements();
         }

< prev index next >