Author: tfmorris
Date: 2008-04-15 21:08:29-0700
New Revision: 14358

Modified:
   trunk/src/app/tests/org/argouml/util/CheckResourceBundle.java
   trunk/src/app/tests/org/argouml/util/TestMyTokenizer.java

Log:
Switch internal use of Vector to List.  Use Java 5 loops.

Modified: trunk/src/app/tests/org/argouml/util/CheckResourceBundle.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/app/tests/org/argouml/util/CheckResourceBundle.java?view=diff&rev=14358&p1=trunk/src/app/tests/org/argouml/util/CheckResourceBundle.java&p2=trunk/src/app/tests/org/argouml/util/CheckResourceBundle.java&r1=14357&r2=14358
==============================================================================
--- trunk/src/app/tests/org/argouml/util/CheckResourceBundle.java       
(original)
+++ trunk/src/app/tests/org/argouml/util/CheckResourceBundle.java       
2008-04-15 21:08:29-0700
@@ -23,8 +23,16 @@
 // UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 
 package org.argouml.util;
-import java.util.*;
-import junit.framework.*;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import junit.framework.Assert;
 
 /**
  *   This class is the base class of tests that tests
@@ -145,15 +153,15 @@
     };
 
     /**
-     * Returns a Vector of Locales modified from list of supported languages.
+     * Returns a List of Locales modified from list of supported languages.
      * Lift up the current locales (actually copying them to the start).
      * This means that it is possible to control what language you are
      * interested in using the -Duser.language=bla and -Duser.country=bla
      * Otherwise it would be a pain to use this since it only reports one
      * error.
      */
-    private static final Vector getModifiedSupportedLanguages() {
-       Vector<Locale> el = new Vector<Locale>();
+    private static final List<Locale> getModifiedSupportedLanguages() {
+       List<Locale> el = new ArrayList<Locale>();
 
        if (System.getProperty("user.language") != null
            && System.getProperty("user.country") != null
@@ -183,9 +191,8 @@
            el.add(new Locale(System.getProperty("user.language"),
                              "", ""));
 
-       Vector<Locale> v = new Vector<Locale>();
-       for (Enumeration ele = el.elements(); ele.hasMoreElements(); ) {
-           Locale elel = (Locale) ele.nextElement();
+       List<Locale> v = new ArrayList<Locale>();
+       for (Locale elel : el) {
            for (int j = 0; j < SUPPORTEDLANGUAGES.length; j++) {
                if (SUPPORTEDLANGUAGES[j] == null)
                    continue;
@@ -231,10 +238,9 @@
 
        // Check the localized parts.
 
-       Vector v = getModifiedSupportedLanguages();
+       List<Locale> v = getModifiedSupportedLanguages();
 
-       for (Enumeration en = v.elements(); en.hasMoreElements(); ) {
-           Locale l = (Locale) en.nextElement();
+       for (Locale l : v) {
 
            ResourceBundle locb = ResourceBundle.getBundle(bname, l);
 

Modified: trunk/src/app/tests/org/argouml/util/TestMyTokenizer.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/app/tests/org/argouml/util/TestMyTokenizer.java?view=diff&rev=14358&p1=trunk/src/app/tests/org/argouml/util/TestMyTokenizer.java&p2=trunk/src/app/tests/org/argouml/util/TestMyTokenizer.java&r1=14357&r2=14358
==============================================================================
--- trunk/src/app/tests/org/argouml/util/TestMyTokenizer.java   (original)
+++ trunk/src/app/tests/org/argouml/util/TestMyTokenizer.java   2008-04-15 
21:08:29-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -24,8 +24,9 @@
 
 package org.argouml.util;
 
+import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Vector;
+import java.util.List;
 
 import junit.framework.TestCase;
 
@@ -48,7 +49,7 @@
      * Test the constructor.
      */
     public void testConstructor1() {
-       Vector<CustomSeparator> seps = new Vector<CustomSeparator>();
+       List<CustomSeparator> seps = new ArrayList<CustomSeparator>();
        seps.add(MyTokenizer.DOUBLE_QUOTED_SEPARATOR);
        seps.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
 
@@ -74,7 +75,7 @@
      * Test the constructor.
      */
     public void testConstructor2() {
-        Vector<CustomSeparator> seps = new Vector<CustomSeparator>();
+        List<CustomSeparator> seps = new ArrayList<CustomSeparator>();
        seps.add(MyTokenizer.DOUBLE_QUOTED_SEPARATOR);
        seps.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
 
@@ -118,7 +119,7 @@
      * Test the constructor.
      */
     public void testConstructor3() {
-        Vector<CustomSeparator> seps = new Vector<CustomSeparator>();
+        List<CustomSeparator> seps = new ArrayList<CustomSeparator>();
        seps.add(MyTokenizer.DOUBLE_QUOTED_SEPARATOR);
        seps.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
 
@@ -144,7 +145,7 @@
      * Test the constructor.
      */
     public void testConstructor4() {
-        Vector<CustomSeparator> seps = new Vector<CustomSeparator>();
+        List<CustomSeparator> seps = new ArrayList<CustomSeparator>();
        seps.add(MyTokenizer.DOUBLE_QUOTED_SEPARATOR);
        seps.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
 
@@ -175,7 +176,7 @@
      * Test the constructor.
      */
     public void testConstructor5() {
-        Vector<CustomSeparator> seps = new Vector<CustomSeparator>();
+        List<CustomSeparator> seps = new ArrayList<CustomSeparator>();
        seps.add(MyTokenizer.DOUBLE_QUOTED_SEPARATOR);
        seps.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
 
@@ -206,7 +207,7 @@
      * Test the constructor.
      */
     public void testConstructor6() {
-        Vector<CustomSeparator> seps = new Vector<CustomSeparator>();
+        List<CustomSeparator> seps = new ArrayList<CustomSeparator>();
        seps.add(MyTokenizer.DOUBLE_QUOTED_SEPARATOR);
        seps.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
 
@@ -237,7 +238,7 @@
      * Test the constructor.
      */
     public void testConstructor7() {
-        Vector<CustomSeparator> seps = new Vector<CustomSeparator>();
+        List<CustomSeparator> seps = new ArrayList<CustomSeparator>();
        seps.add(MyTokenizer.DOUBLE_QUOTED_SEPARATOR);
        seps.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to