Changeset 160:1b7b566e7000 in livinglogic.java.ul4

Show
Ignore:
Timestamp:
07/23/08 19:00:47 (11 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Optimize the common case, that the key exists.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/src/com/livinglogic/ul4/Utils.java

    r159 r160  
    371371    public static Object getItem(Map arg1, Object arg2) 
    372372    { 
    373         if (arg1.containsKey(arg2)) 
    374             return arg1.get(arg2); 
    375         else 
     373        Object result = arg1.get(arg2); 
     374 
     375        if ((result == null) && !arg1.containsKey(arg2)) 
    376376            throw new KeyException(arg2); 
     377        return result; 
    377378    } 
    378379