commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r828943 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/LookupTranslator.java
Date Fri, 23 Oct 2009 06:44:46 GMT
Author: bayard
Date: Fri Oct 23 06:44:45 2009
New Revision: 828943

URL: http://svn.apache.org/viewvc?rev=828943&view=rev
Log:
Making private fields final per Sebb's patch to LANG-540

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/LookupTranslator.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/LookupTranslator.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/LookupTranslator.java?rev=828943&r1=828942&r2=828943&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/LookupTranslator.java
(original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/LookupTranslator.java
Fri Oct 23 06:44:45 2009
@@ -27,9 +27,9 @@
 // TODO: Replace with a RegexLookup? Performance test.
 public class LookupTranslator extends CharSequenceTranslator {
 
-    private HashMap<CharSequence, CharSequence> lookupMap;
-    private int shortest = Integer.MAX_VALUE;
-    private int longest = 0;
+    private final HashMap<CharSequence, CharSequence> lookupMap;
+    private final int shortest;
+    private final int longest;
 
     /**
      * Define the lookup table to be used in translation
@@ -38,16 +38,20 @@
      */
     public LookupTranslator(CharSequence[][] lookup) {
         lookupMap = new HashMap<CharSequence, CharSequence>();
+        int _shortest = Integer.MAX_VALUE;
+        int _longest = 0;
         for(CharSequence[] seq : lookup) {
             this.lookupMap.put(seq[0], seq[1]);
             int sz = seq[0].length();
-            if(sz < shortest) {
-                shortest = sz;
+            if(sz < _shortest) {
+                _shortest = sz;
             }
-            if(sz > longest) {
-                longest = sz;
+            if(sz > _longest) {
+                _longest = sz;
             }
         }
+        shortest = _shortest;
+        longest = _longest;
     }
 
     /**



Mime
View raw message