mirror of
https://github.com/apache/commons-collections.git
synced 2025-02-25 20:18:31 +00:00
Simplify and performance improvement for getFreq
bug 23004, from Janek Bogucki git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131150 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c4d88de091
commit
fc4c3af2c5
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/CollectionUtils.java,v 1.40 2003/09/09 21:36:53 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/CollectionUtils.java,v 1.41 2003/09/09 21:53:04 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
@ -67,7 +67,6 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.collections.decorators.PredicatedCollection;
|
import org.apache.commons.collections.decorators.PredicatedCollection;
|
||||||
@ -81,7 +80,7 @@ import org.apache.commons.collections.iterators.EnumerationIterator;
|
|||||||
* A set of {@link Collection} related utility methods.
|
* A set of {@link Collection} related utility methods.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 1.0
|
* @since Commons Collections 1.0
|
||||||
* @version $Revision: 1.40 $ $Date: 2003/09/09 21:36:53 $
|
* @version $Revision: 1.41 $ $Date: 2003/09/09 21:53:04 $
|
||||||
*
|
*
|
||||||
* @author Rodney Waldhoff
|
* @author Rodney Waldhoff
|
||||||
* @author Paul Jack
|
* @author Paul Jack
|
||||||
@ -826,12 +825,9 @@ public class CollectionUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final int getFreq(final Object obj, final Map freqMap) {
|
private static final int getFreq(final Object obj, final Map freqMap) {
|
||||||
try {
|
Integer count = (Integer) freqMap.get(obj);
|
||||||
return ((Integer)(freqMap.get(obj))).intValue();
|
if (count != null) {
|
||||||
} catch(NullPointerException e) {
|
return count.intValue();
|
||||||
// ignored
|
|
||||||
} catch(NoSuchElementException e) {
|
|
||||||
// ignored
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user