< prev index next >

src/share/classes/javax/swing/ActionMap.java

Print this page
rev 1527 : 6727662: Code improvement and warnings removing from swing packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: malenkov


 180             if (parent != null) {
 181                 return parent.allKeys();
 182             }
 183             return keys();
 184         }
 185         if (parent == null) {
 186             return keys();
 187         }
 188         Object[]    keys = keys();
 189         Object[]    pKeys =  parent.allKeys();
 190 
 191         if (pKeys == null) {
 192             return keys;
 193         }
 194         if (keys == null) {
 195             // Should only happen if size() != keys.length, which should only
 196             // happen if mutated from multiple threads (or a bogus subclass).
 197             return pKeys;
 198         }
 199 
 200         HashMap        keyMap = new HashMap();
 201         int            counter;
 202 
 203         for (counter = keys.length - 1; counter >= 0; counter--) {
 204             keyMap.put(keys[counter], keys[counter]);
 205         }
 206         for (counter = pKeys.length - 1; counter >= 0; counter--) {
 207             keyMap.put(pKeys[counter], pKeys[counter]);
 208         }
 209         return keyMap.keySet().toArray();
 210     }
 211 
 212     private void writeObject(ObjectOutputStream s) throws IOException {
 213         s.defaultWriteObject();
 214 
 215         ArrayTable.writeArrayTable(s, arrayTable);
 216     }
 217 
 218     private void readObject(ObjectInputStream s) throws ClassNotFoundException,
 219                                                  IOException {
 220         s.defaultReadObject();


 180             if (parent != null) {
 181                 return parent.allKeys();
 182             }
 183             return keys();
 184         }
 185         if (parent == null) {
 186             return keys();
 187         }
 188         Object[]    keys = keys();
 189         Object[]    pKeys =  parent.allKeys();
 190 
 191         if (pKeys == null) {
 192             return keys;
 193         }
 194         if (keys == null) {
 195             // Should only happen if size() != keys.length, which should only
 196             // happen if mutated from multiple threads (or a bogus subclass).
 197             return pKeys;
 198         }
 199 
 200         HashMap<Object, Object> keyMap = new HashMap<Object, Object>();
 201         int            counter;
 202 
 203         for (counter = keys.length - 1; counter >= 0; counter--) {
 204             keyMap.put(keys[counter], keys[counter]);
 205         }
 206         for (counter = pKeys.length - 1; counter >= 0; counter--) {
 207             keyMap.put(pKeys[counter], pKeys[counter]);
 208         }
 209         return keyMap.keySet().toArray();
 210     }
 211 
 212     private void writeObject(ObjectOutputStream s) throws IOException {
 213         s.defaultWriteObject();
 214 
 215         ArrayTable.writeArrayTable(s, arrayTable);
 216     }
 217 
 218     private void readObject(ObjectInputStream s) throws ClassNotFoundException,
 219                                                  IOException {
 220         s.defaultReadObject();
< prev index next >