diff src/org/tn5250j/framework/tn5250/Screen5250.java @ 107:afe6962769b9

use hash map rather than linear search thru arrays
author Carl Byington <carl@five-ten-sg.com>
date Wed, 18 Jun 2014 11:43:08 -0700
parents 12425771714d
children ae3092cd9cbf
line wrap: on
line diff
--- a/src/org/tn5250j/framework/tn5250/Screen5250.java	Wed Jun 18 10:38:46 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/Screen5250.java	Wed Jun 18 11:43:08 2014 -0700
@@ -553,23 +553,15 @@
     }
 
     /**
-     * Searches the mnemonicData array looking for the specified string. If it
-     * is found it will return the value associated from the mnemonicValue
+     * converts mnemonic string values into aid integers
      *
      * @see #sendKeys
-     * @param mnem
-     *            string mnemonic value
+     * @param mnem string mnemonic value
      * @return key value of Mnemonic
      */
     private int getMnemonicValue(String mnem) {
-
-        for (int x = 0; x < mnemonicData.length; x++) {
-
-            if (mnemonicData[x].equals(mnem))
-                return mnemonicValue[x];
-        }
+        if (mnemonicMap.containsKey(mnem)) return mnemonicsMap.get(mnem);
         return 0;
-
     }
 
     protected void setPrehelpState(boolean setErrorCode, boolean lockKeyboard,