commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1302517 - /commons/proper/bcel/trunk/src/examples/Mini/Environment.java
Date Mon, 19 Mar 2012 15:52:49 GMT
Author: sebb
Date: Mon Mar 19 15:52:49 2012
New Revision: 1302517

URL: http://svn.apache.org/viewvc?rev=1302517&view=rev
Log:
Fix up some generics warnings

Modified:
    commons/proper/bcel/trunk/src/examples/Mini/Environment.java

Modified: commons/proper/bcel/trunk/src/examples/Mini/Environment.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/examples/Mini/Environment.java?rev=1302517&r1=1302516&r2=1302517&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/examples/Mini/Environment.java (original)
+++ commons/proper/bcel/trunk/src/examples/Mini/Environment.java Mon Mar 19 15:52:49 2012
@@ -37,7 +37,7 @@ public class Environment implements Clon
   private static final int SLOTS = 3;   // Number of slots of each field
   
   private int       size;               // The table is an array of
-  private Vector[]  table;              // Vectors
+  private Vector<EnvEntry>[]  table;              // Vectors
   private int       elements=0;
 
   public Environment(int size) {
@@ -45,7 +45,7 @@ public class Environment implements Clon
     table     = new Vector[size];
   }
 
-  private Environment(Vector[] table) {
+  private Environment(Vector<EnvEntry>[] table) {
     size       = table.length;
     this.table = table;
   }
@@ -64,7 +64,7 @@ public class Environment implements Clon
    */
   public void put(EnvEntry obj) {
     int    hash;
-    Vector v;
+    Vector<EnvEntry> v;
     String key = obj.getHashKey();
 
     hash = hashCode(key);
@@ -73,7 +73,7 @@ public class Environment implements Clon
     elements++; // Count
 
     if(v == null) {
-        table[hash] = v = new Vector(SLOTS);
+        table[hash] = v = new Vector<EnvEntry>(SLOTS);
     } else {
       try {
         int index = lookup(v, key);
@@ -93,7 +93,7 @@ public class Environment implements Clon
    */
   public EnvEntry get(String key) {
     int       hash;
-    Vector    v;
+    Vector<EnvEntry>    v;
     EnvEntry entry = null;
 
     hash = hashCode(key);
@@ -107,7 +107,7 @@ public class Environment implements Clon
       int index = lookup(v, key);
 
       if(index >= 0) {
-        entry = (EnvEntry)v.elementAt(index);
+        entry = v.elementAt(index);
     }
     } catch(ArrayIndexOutOfBoundsException e) {}
 
@@ -119,7 +119,7 @@ public class Environment implements Clon
    */
   public void delete(String key) {
     int       hash;
-    Vector    v;
+    Vector<EnvEntry>    v;
 
     hash = hashCode(key);
     v    = table[hash];
@@ -138,13 +138,13 @@ public class Environment implements Clon
     } catch(ArrayIndexOutOfBoundsException e) {}
   }
 
-  private static final int lookup(Vector v, String key) 
+  private static final int lookup(Vector<EnvEntry> v, String key) 
        throws ArrayIndexOutOfBoundsException
   {
     int len = v.size();
 
     for(int i=0; i < len; i++) {
-      EnvEntry entry = (EnvEntry)v.elementAt(i);
+      EnvEntry entry = v.elementAt(i);
 
       if(entry.getHashKey().equals(key)) {
         return i;
@@ -156,7 +156,7 @@ public class Environment implements Clon
 
   @Override
   public Object clone() { 
-    Vector[] copy = new Vector[size];
+    Vector<EnvEntry>[] copy = new Vector[size];
 
     for(int i=0; i < size; i++) {
       if(table[i] != null) {
@@ -192,14 +192,14 @@ public class Environment implements Clon
   public EnvEntry[] getEntries() {
     EnvEntry[] entries = new EnvEntry[elements];
     int        k       = 0;
-    Vector     v;
+    Vector<EnvEntry>     v;
 
     for(int i=0; i < size; i++) {
       if((v = table[i]) != null) {
         int len = v.size();
         try {
           for(int j=0; j < len; j++) {
-        entries[k++] = (EnvEntry)v.elementAt(j);
+        entries[k++] = v.elementAt(j);
     }
         } catch(ArrayIndexOutOfBoundsException e) {}  
       }



Mime
View raw message