commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1091095 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
Date Mon, 11 Apr 2011 15:06:32 GMT
Author: mbenson
Date: Mon Apr 11 15:06:32 2011
New Revision: 1091095

URL: http://svn.apache.org/viewvc?rev=1091095&view=rev
Log:
varargs

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

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java?rev=1091095&r1=1091094&r2=1091095&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
Mon Apr 11 15:06:32 2011
@@ -37,18 +37,20 @@ public class LookupTranslator extends Ch
      *
      * @param lookup CharSequence[][] table of size [*][2]
      */
-    public LookupTranslator(CharSequence[][] lookup) {
+    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 > _longest) {
-                _longest = sz;
+        if (lookup != null) {
+            for (CharSequence[] seq : lookup) {
+                this.lookupMap.put(seq[0], seq[1]);
+                int sz = seq[0].length();
+                if(sz < _shortest) {
+                    _shortest = sz;
+                }
+                if(sz > _longest) {
+                    _longest = sz;
+                }
             }
         }
         shortest = _shortest;



Mime
View raw message