commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections CollectionUtils.java
Date Tue, 09 Sep 2003 21:53:04 GMT
scolebourne    2003/09/09 14:53:04

  Modified:    collections/src/java/org/apache/commons/collections
                        CollectionUtils.java
  Log:
  Simplify and performance improvement for getFreq
  bug 23004, from Janek Bogucki
  
  Revision  Changes    Path
  1.41      +5 -9      jakarta-commons/collections/src/java/org/apache/commons/collections/CollectionUtils.java
  
  Index: CollectionUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/CollectionUtils.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- CollectionUtils.java	9 Sep 2003 21:36:53 -0000	1.40
  +++ CollectionUtils.java	9 Sep 2003 21:53:04 -0000	1.41
  @@ -67,7 +67,6 @@
   import java.util.List;
   import java.util.ListIterator;
   import java.util.Map;
  -import java.util.NoSuchElementException;
   import java.util.Set;
   
   import org.apache.commons.collections.decorators.PredicatedCollection;
  @@ -826,12 +825,9 @@
       }
   
       private static final int getFreq(final Object obj, final Map freqMap) {
  -        try {
  -            return ((Integer)(freqMap.get(obj))).intValue();
  -        } catch(NullPointerException e) {
  -            // ignored
  -        } catch(NoSuchElementException e) {
  -            // ignored
  +        Integer count = (Integer) freqMap.get(obj);
  +        if (count != null) {
  +            return count.intValue();
           }
           return 0;
       }
  
  
  

Mime
View raw message