Replace IteratorUtils calls with direct implementation calls
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131754 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
19a707c06d
commit
457b48b892
|
@ -58,6 +58,8 @@ No deprecations have occurred.
|
|||
<li>AbstractLinkedList/NodeCachingLinkedList - added getValue() and setValue() to Node, and made everything use them</li>
|
||||
<li>LRUMap - The addMapping() method now uses isFull() to determine whether it is full</li>
|
||||
<li>LRUMap - Add boolean flag, scanUntilRemovable, giving the removeLRU() method more power [28887]</li>
|
||||
<li>InvokerTransformer - Add additional getInstance() method</li>
|
||||
<li>Reduced inter-class and inter-package dependencies, especially via *Utils classes</li>
|
||||
</ul>
|
||||
|
||||
<h4>Made Serializable</h4>
|
||||
|
|
|
@ -26,6 +26,8 @@ import java.util.Map;
|
|||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.iterators.EmptyIterator;
|
||||
|
||||
/**
|
||||
* <code>MultiHashMap</code> is the default implementation of the
|
||||
* {@link org.apache.commons.collections.MultiMap MultiMap} interface.
|
||||
|
@ -50,7 +52,7 @@ import java.util.Set;
|
|||
* <code>list</code> will be a list containing "A", "B", "C".
|
||||
*
|
||||
* @since Commons Collections 2.0
|
||||
* @version $Revision: 1.18 $ $Date: 2004/05/14 22:33:31 $
|
||||
* @version $Revision: 1.19 $ $Date: 2004/05/26 21:56:05 $
|
||||
*
|
||||
* @author Christopher Berry
|
||||
* @author James Strachan
|
||||
|
@ -199,7 +201,7 @@ public class MultiHashMap extends HashMap implements MultiMap {
|
|||
public Iterator iterator(Object key) {
|
||||
Collection coll = getCollection(key);
|
||||
if (coll == null) {
|
||||
return IteratorUtils.EMPTY_ITERATOR;
|
||||
return EmptyIterator.INSTANCE;
|
||||
}
|
||||
return coll.iterator();
|
||||
}
|
||||
|
|
|
@ -24,12 +24,12 @@ import java.util.NoSuchElementException;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.collections.KeyValue;
|
||||
import org.apache.commons.collections.MapIterator;
|
||||
import org.apache.commons.collections.OrderedBidiMap;
|
||||
import org.apache.commons.collections.OrderedIterator;
|
||||
import org.apache.commons.collections.OrderedMapIterator;
|
||||
import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
|
||||
import org.apache.commons.collections.keyvalue.UnmodifiableMapEntry;
|
||||
|
||||
/**
|
||||
|
@ -67,7 +67,7 @@ import org.apache.commons.collections.keyvalue.UnmodifiableMapEntry;
|
|||
* UnsupportedOperationException on attempts to call that method.
|
||||
*
|
||||
* @since Commons Collections 3.0 (previously DoubleOrderedMap v2.0)
|
||||
* @version $Revision: 1.13 $ $Date: 2004/05/15 11:59:15 $
|
||||
* @version $Revision: 1.14 $ $Date: 2004/05/26 21:58:02 $
|
||||
*
|
||||
* @author Marc Johnson
|
||||
* @author Stephen Colebourne
|
||||
|
@ -406,7 +406,7 @@ public class TreeBidiMap implements OrderedBidiMap {
|
|||
*/
|
||||
public MapIterator mapIterator() {
|
||||
if (isEmpty()) {
|
||||
return IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR;
|
||||
return EmptyOrderedMapIterator.INSTANCE;
|
||||
}
|
||||
return new ViewMapIterator(this, KEY);
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ public class TreeBidiMap implements OrderedBidiMap {
|
|||
*/
|
||||
public OrderedMapIterator orderedMapIterator() {
|
||||
if (isEmpty()) {
|
||||
return IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR;
|
||||
return EmptyOrderedMapIterator.INSTANCE;
|
||||
}
|
||||
return new ViewMapIterator(this, KEY);
|
||||
}
|
||||
|
@ -2048,14 +2048,14 @@ public class TreeBidiMap implements OrderedBidiMap {
|
|||
|
||||
public MapIterator mapIterator() {
|
||||
if (isEmpty()) {
|
||||
return IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR;
|
||||
return EmptyOrderedMapIterator.INSTANCE;
|
||||
}
|
||||
return new ViewMapIterator(main, VALUE);
|
||||
}
|
||||
|
||||
public OrderedMapIterator orderedMapIterator() {
|
||||
if (isEmpty()) {
|
||||
return IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR;
|
||||
return EmptyOrderedMapIterator.INSTANCE;
|
||||
}
|
||||
return new ViewMapIterator(main, VALUE);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.collections.iterators.EmptyIterator;
|
||||
import org.apache.commons.collections.iterators.IteratorChain;
|
||||
import org.apache.commons.collections.list.UnmodifiableList;
|
||||
|
||||
|
@ -33,7 +33,7 @@ import org.apache.commons.collections.list.UnmodifiableList;
|
|||
* strategy is provided then add and remove are unsupported.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.6 $ $Date: 2004/05/15 12:39:13 $
|
||||
* @version $Revision: 1.7 $ $Date: 2004/05/26 21:58:02 $
|
||||
*
|
||||
* @author Brian McCallister
|
||||
* @author Stephen Colebourne
|
||||
|
@ -137,7 +137,7 @@ public class CompositeCollection implements Collection {
|
|||
*/
|
||||
public Iterator iterator() {
|
||||
if (this.all.length == 0) {
|
||||
return IteratorUtils.EMPTY_ITERATOR;
|
||||
return EmptyIterator.INSTANCE;
|
||||
}
|
||||
IteratorChain chain = new IteratorChain();
|
||||
for (int i = 0; i < this.all.length; ++i) {
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Collection;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.collections.list.UnmodifiableList;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +42,7 @@ import org.apache.commons.collections.list.UnmodifiableList;
|
|||
* iterators. In this case the class will function as an empty iterator.
|
||||
*
|
||||
* @since Commons Collections 2.1
|
||||
* @version $Revision: 1.12 $ $Date: 2004/02/18 00:59:50 $
|
||||
* @version $Revision: 1.13 $ $Date: 2004/05/26 21:58:02 $
|
||||
*
|
||||
* @author Morgan Delagrange
|
||||
* @author Stephen Colebourne
|
||||
|
@ -222,7 +221,7 @@ public class IteratorChain implements Iterator {
|
|||
protected void updateCurrentIterator() {
|
||||
if (currentIterator == null) {
|
||||
if (iteratorChain.isEmpty()) {
|
||||
currentIterator = IteratorUtils.EMPTY_ITERATOR;
|
||||
currentIterator = EmptyIterator.INSTANCE;
|
||||
} else {
|
||||
currentIterator = (Iterator) iteratorChain.get(0);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ import org.apache.commons.collections.OrderedIterator;
|
|||
* does use sligtly more memory.
|
||||
*
|
||||
* @since Commons Collections 3.1
|
||||
* @version $Revision: 1.2 $ $Date: 2004/05/12 23:24:45 $
|
||||
* @version $Revision: 1.3 $ $Date: 2004/05/26 21:56:05 $
|
||||
*
|
||||
* @author Joerg Schmuecker
|
||||
* @author Stephen Colebourne
|
||||
|
@ -135,7 +135,7 @@ public class TreeList extends AbstractList {
|
|||
*/
|
||||
public ListIterator listIterator(int fromIndex) {
|
||||
// override to go 75% faster
|
||||
// cannot use IteratorUtils.EMPTY_ITERATOR as iterator.add() must work
|
||||
// cannot use EmptyIterator as iterator.add() must work
|
||||
checkInterval(fromIndex, 0, size());
|
||||
return new TreeListIterator(this, fromIndex);
|
||||
}
|
||||
|
|
|
@ -28,9 +28,10 @@ import java.util.NoSuchElementException;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.IterableMap;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.collections.KeyValue;
|
||||
import org.apache.commons.collections.MapIterator;
|
||||
import org.apache.commons.collections.iterators.EmptyIterator;
|
||||
import org.apache.commons.collections.iterators.EmptyMapIterator;
|
||||
|
||||
/**
|
||||
* An abstract implementation of a hash-based map which provides numerous points for
|
||||
|
@ -46,7 +47,7 @@ import org.apache.commons.collections.MapIterator;
|
|||
* need for unusual subclasses is here.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.17 $ $Date: 2004/04/27 21:28:40 $
|
||||
* @version $Revision: 1.18 $ $Date: 2004/05/26 21:56:05 $
|
||||
*
|
||||
* @author java util HashMap
|
||||
* @author Stephen Colebourne
|
||||
|
@ -713,7 +714,7 @@ public class AbstractHashedMap implements IterableMap {
|
|||
*/
|
||||
public MapIterator mapIterator() {
|
||||
if (size == 0) {
|
||||
return IteratorUtils.EMPTY_MAP_ITERATOR;
|
||||
return EmptyMapIterator.INSTANCE;
|
||||
}
|
||||
return new HashMapIterator(this);
|
||||
}
|
||||
|
@ -779,7 +780,7 @@ public class AbstractHashedMap implements IterableMap {
|
|||
*/
|
||||
protected Iterator createEntrySetIterator() {
|
||||
if (size() == 0) {
|
||||
return IteratorUtils.EMPTY_ITERATOR;
|
||||
return EmptyIterator.INSTANCE;
|
||||
}
|
||||
return new EntrySetIterator(this);
|
||||
}
|
||||
|
@ -868,7 +869,7 @@ public class AbstractHashedMap implements IterableMap {
|
|||
*/
|
||||
protected Iterator createKeySetIterator() {
|
||||
if (size() == 0) {
|
||||
return IteratorUtils.EMPTY_ITERATOR;
|
||||
return EmptyIterator.INSTANCE;
|
||||
}
|
||||
return new KeySetIterator(this);
|
||||
}
|
||||
|
@ -945,7 +946,7 @@ public class AbstractHashedMap implements IterableMap {
|
|||
*/
|
||||
protected Iterator createValuesIterator() {
|
||||
if (size() == 0) {
|
||||
return IteratorUtils.EMPTY_ITERATOR;
|
||||
return EmptyIterator.INSTANCE;
|
||||
}
|
||||
return new ValuesIterator(this);
|
||||
}
|
||||
|
|
|
@ -20,12 +20,13 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.collections.MapIterator;
|
||||
import org.apache.commons.collections.OrderedIterator;
|
||||
import org.apache.commons.collections.OrderedMap;
|
||||
import org.apache.commons.collections.OrderedMapIterator;
|
||||
import org.apache.commons.collections.ResettableIterator;
|
||||
import org.apache.commons.collections.iterators.EmptyOrderedIterator;
|
||||
import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
|
||||
|
||||
/**
|
||||
* An abstract implementation of a hash-based map that links entries to create an
|
||||
|
@ -56,7 +57,7 @@ import org.apache.commons.collections.ResettableIterator;
|
|||
* methods exposed.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.11 $ $Date: 2004/04/09 22:52:48 $
|
||||
* @version $Revision: 1.12 $ $Date: 2004/05/26 21:56:05 $
|
||||
*
|
||||
* @author java util LinkedHashMap
|
||||
* @author Stephen Colebourne
|
||||
|
@ -331,7 +332,7 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
|
|||
*/
|
||||
public MapIterator mapIterator() {
|
||||
if (size == 0) {
|
||||
return IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR;
|
||||
return EmptyOrderedMapIterator.INSTANCE;
|
||||
}
|
||||
return new LinkMapIterator(this);
|
||||
}
|
||||
|
@ -348,7 +349,7 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
|
|||
*/
|
||||
public OrderedMapIterator orderedMapIterator() {
|
||||
if (size == 0) {
|
||||
return IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR;
|
||||
return EmptyOrderedMapIterator.INSTANCE;
|
||||
}
|
||||
return new LinkMapIterator(this);
|
||||
}
|
||||
|
@ -404,7 +405,7 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
|
|||
*/
|
||||
protected Iterator createEntrySetIterator() {
|
||||
if (size() == 0) {
|
||||
return IteratorUtils.EMPTY_ORDERED_ITERATOR;
|
||||
return EmptyOrderedIterator.INSTANCE;
|
||||
}
|
||||
return new EntrySetIterator(this);
|
||||
}
|
||||
|
@ -436,7 +437,7 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
|
|||
*/
|
||||
protected Iterator createKeySetIterator() {
|
||||
if (size() == 0) {
|
||||
return IteratorUtils.EMPTY_ORDERED_ITERATOR;
|
||||
return EmptyOrderedIterator.INSTANCE;
|
||||
}
|
||||
return new KeySetIterator(this);
|
||||
}
|
||||
|
@ -468,7 +469,7 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
|
|||
*/
|
||||
protected Iterator createValuesIterator() {
|
||||
if (size() == 0) {
|
||||
return IteratorUtils.EMPTY_ORDERED_ITERATOR;
|
||||
return EmptyOrderedIterator.INSTANCE;
|
||||
}
|
||||
return new ValuesIterator(this);
|
||||
}
|
||||
|
|
|
@ -28,9 +28,10 @@ import java.util.NoSuchElementException;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.IterableMap;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.collections.MapIterator;
|
||||
import org.apache.commons.collections.ResettableIterator;
|
||||
import org.apache.commons.collections.iterators.EmptyIterator;
|
||||
import org.apache.commons.collections.iterators.EmptyMapIterator;
|
||||
|
||||
/**
|
||||
* A <code>Map</code> implementation that stores data in simple fields until
|
||||
|
@ -60,7 +61,7 @@ import org.apache.commons.collections.ResettableIterator;
|
|||
* Do not use <code>Flat3Map</code> if the size is likely to grow beyond 3.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.17 $ $Date: 2004/05/03 22:57:40 $
|
||||
* @version $Revision: 1.18 $ $Date: 2004/05/26 21:56:05 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -566,7 +567,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
|
|||
return delegateMap.mapIterator();
|
||||
}
|
||||
if (size == 0) {
|
||||
return IteratorUtils.EMPTY_MAP_ITERATOR;
|
||||
return EmptyMapIterator.INSTANCE;
|
||||
}
|
||||
return new FlatMapIterator(this);
|
||||
}
|
||||
|
@ -717,7 +718,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
|
|||
return parent.delegateMap.entrySet().iterator();
|
||||
}
|
||||
if (parent.size() == 0) {
|
||||
return IteratorUtils.EMPTY_ITERATOR;
|
||||
return EmptyIterator.INSTANCE;
|
||||
}
|
||||
return new EntrySetIterator(parent);
|
||||
}
|
||||
|
@ -885,7 +886,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
|
|||
return parent.delegateMap.keySet().iterator();
|
||||
}
|
||||
if (parent.size() == 0) {
|
||||
return IteratorUtils.EMPTY_ITERATOR;
|
||||
return EmptyIterator.INSTANCE;
|
||||
}
|
||||
return new KeySetIterator(parent);
|
||||
}
|
||||
|
@ -948,7 +949,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
|
|||
return parent.delegateMap.values().iterator();
|
||||
}
|
||||
if (parent.size() == 0) {
|
||||
return IteratorUtils.EMPTY_ITERATOR;
|
||||
return EmptyIterator.INSTANCE;
|
||||
}
|
||||
return new ValuesIterator(parent);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue