Use the Unmodifiable decorators everywhere

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-12-03 11:37:44 +00:00
parent 1064cdbedb
commit 3c5ad2e9ae
14 changed files with 65 additions and 58 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/BeanMap.java,v 1.22 2003/10/03 23:19:32 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/BeanMap.java,v 1.23 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -68,12 +68,13 @@ import java.util.AbstractMap;
import java.util.AbstractSet; import java.util.AbstractSet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import org.apache.commons.collections.list.UnmodifiableList;
import org.apache.commons.collections.pairs.AbstractMapEntry; import org.apache.commons.collections.pairs.AbstractMapEntry;
import org.apache.commons.collections.set.UnmodifiableSet;
/** /**
* An implementation of Map for JavaBeans which uses introspection to * An implementation of Map for JavaBeans which uses introspection to
@ -83,7 +84,7 @@ import org.apache.commons.collections.pairs.AbstractMapEntry;
* property is considered non existent in the Map * property is considered non existent in the Map
* *
* @since Commons Collections 1.0 * @since Commons Collections 1.0
* @version $Revision: 1.22 $ $Date: 2003/10/03 23:19:32 $ * @version $Revision: 1.23 $ $Date: 2003/12/03 11:37:44 $
* *
* @author James Strachan * @author James Strachan
* @author Stephen Colebourne * @author Stephen Colebourne
@ -444,7 +445,7 @@ public class BeanMap extends AbstractMap implements Cloneable {
* modifiable. * modifiable.
*/ */
public Set keySet() { public Set keySet() {
return Collections.unmodifiableSet(readMethods.keySet()); return UnmodifiableSet.decorate(readMethods.keySet());
} }
/** /**
@ -455,7 +456,7 @@ public class BeanMap extends AbstractMap implements Cloneable {
* @return the unmodifiable set of mappings * @return the unmodifiable set of mappings
*/ */
public Set entrySet() { public Set entrySet() {
return Collections.unmodifiableSet(new AbstractSet() { return new AbstractSet() {
public Iterator iterator() { public Iterator iterator() {
return new Iterator() { return new Iterator() {
@ -481,7 +482,7 @@ public class BeanMap extends AbstractMap implements Cloneable {
public int size() { public int size() {
return BeanMap.this.readMethods.size(); return BeanMap.this.readMethods.size();
} }
}); };
} }
/** /**
@ -495,7 +496,7 @@ public class BeanMap extends AbstractMap implements Cloneable {
for ( Iterator iter = valueIterator(); iter.hasNext(); ) { for ( Iterator iter = valueIterator(); iter.hasNext(); ) {
answer.add( iter.next() ); answer.add( iter.next() );
} }
return Collections.unmodifiableList(answer); return UnmodifiableList.decorate(answer);
} }

View File

@ -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.49 2003/11/29 18:14:20 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.50 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -59,7 +59,6 @@ package org.apache.commons.collections;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -84,7 +83,7 @@ import org.apache.commons.collections.observed.ObservableCollection;
* Provides utility methods and decorators for {@link Collection} instances. * Provides utility methods and decorators for {@link Collection} instances.
* *
* @since Commons Collections 1.0 * @since Commons Collections 1.0
* @version $Revision: 1.49 $ $Date: 2003/11/29 18:14:20 $ * @version $Revision: 1.50 $ $Date: 2003/12/03 11:37:44 $
* *
* @author Rodney Waldhoff * @author Rodney Waldhoff
* @author Paul Jack * @author Paul Jack
@ -107,7 +106,7 @@ public class CollectionUtils {
* this purpose. However they could be cast to Set or List which might be * this purpose. However they could be cast to Set or List which might be
* undesirable. This implementation only implements Collection. * undesirable. This implementation only implements Collection.
*/ */
public static final Collection EMPTY_COLLECTION = Collections.unmodifiableCollection(new ArrayList()); public static final Collection EMPTY_COLLECTION = UnmodifiableCollection.decorate(new ArrayList());
/** /**
* <code>CollectionUtils</code> should not normally be instantiated. * <code>CollectionUtils</code> should not normally be instantiated.

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/DefaultMapBag.java,v 1.11 2003/12/02 23:36:12 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/DefaultMapBag.java,v 1.12 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -59,13 +59,14 @@ package org.apache.commons.collections;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.ConcurrentModificationException; import java.util.ConcurrentModificationException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.commons.collections.set.UnmodifiableSet;
/** /**
* A skeletal implementation of the {@link Bag} * A skeletal implementation of the {@link Bag}
* interface to minimize the effort required for target implementations. * interface to minimize the effort required for target implementations.
@ -79,7 +80,7 @@ import java.util.Set;
* *
* @deprecated Moved to bag subpackage as AbstractMapBag. Due to be removed in v4.0. * @deprecated Moved to bag subpackage as AbstractMapBag. Due to be removed in v4.0.
* @since Commons Collections 2.0 * @since Commons Collections 2.0
* @version $Revision: 1.11 $ $Date: 2003/12/02 23:36:12 $ * @version $Revision: 1.12 $ $Date: 2003/12/03 11:37:44 $
* *
* @author Chuck Burdick * @author Chuck Burdick
* @author Michael A. Smith * @author Michael A. Smith
@ -391,7 +392,7 @@ public abstract class DefaultMapBag implements Bag {
* @return the set of unique elements in this bag * @return the set of unique elements in this bag
*/ */
public Set uniqueSet() { public Set uniqueSet() {
return Collections.unmodifiableSet(_map.keySet()); return UnmodifiableSet.decorate(_map.keySet());
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/MapUtils.java,v 1.39 2003/11/16 00:05:44 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/MapUtils.java,v 1.40 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -109,7 +109,7 @@ import org.apache.commons.collections.map.UnmodifiableSortedMap;
* </ul> * </ul>
* *
* @since Commons Collections 1.0 * @since Commons Collections 1.0
* @version $Revision: 1.39 $ $Date: 2003/11/16 00:05:44 $ * @version $Revision: 1.40 $ $Date: 2003/12/03 11:37:44 $
* *
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a> * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @author <a href="mailto:nissim@nksystems.com">Nissim Karpenstein</a> * @author <a href="mailto:nissim@nksystems.com">Nissim Karpenstein</a>
@ -127,12 +127,12 @@ public class MapUtils {
* An empty unmodifiable map. * An empty unmodifiable map.
* This was not provided in JDK1.2. * This was not provided in JDK1.2.
*/ */
public static final Map EMPTY_MAP = Collections.unmodifiableMap(new HashMap(1)); public static final Map EMPTY_MAP = UnmodifiableMap.decorate(new HashMap(1));
/** /**
* An empty unmodifiable sorted map. * An empty unmodifiable sorted map.
* This is not provided in the JDK. * This is not provided in the JDK.
*/ */
public static final SortedMap EMPTY_SORTED_MAP = Collections.unmodifiableSortedMap(new TreeMap()); public static final SortedMap EMPTY_SORTED_MAP = UnmodifiableSortedMap.decorate(new TreeMap());
/** /**
* String used to indent the verbose and debug Map prints. * String used to indent the verbose and debug Map prints.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/SequencedHashMap.java,v 1.21 2003/11/23 14:40:41 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/SequencedHashMap.java,v 1.22 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -65,7 +65,6 @@ import java.util.AbstractCollection;
import java.util.AbstractSet; import java.util.AbstractSet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.ConcurrentModificationException; import java.util.ConcurrentModificationException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -74,6 +73,8 @@ import java.util.Map;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Set; import java.util.Set;
import org.apache.commons.collections.list.UnmodifiableList;
/** /**
* A map of objects whose mapping entries are sequenced based on the order in * A map of objects whose mapping entries are sequenced based on the order in
* which they were added. This data structure has fast <i>O(1)</i> search * which they were added. This data structure has fast <i>O(1)</i> search
@ -90,7 +91,7 @@ import java.util.Set;
* *
* @see org.apache.commons.collections.set.ListOrderedSet * @see org.apache.commons.collections.set.ListOrderedSet
* @since Commons Collections 2.0 * @since Commons Collections 2.0
* @version $Revision: 1.21 $ $Date: 2003/11/23 14:40:41 $ * @version $Revision: 1.22 $ $Date: 2003/12/03 11:37:44 $
* *
* @author Michael A. Smith * @author Michael A. Smith
* @author Daniel Rall * @author Daniel Rall
@ -1000,7 +1001,7 @@ public class SequencedHashMap implements Map, Cloneable, Externalizable {
l.add(iter.next()); l.add(iter.next());
} }
return Collections.unmodifiableList(l); return UnmodifiableList.decorate(l);
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/SetUtils.java,v 1.20 2003/11/27 22:55:16 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/SetUtils.java,v 1.21 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -84,7 +84,7 @@ import org.apache.commons.collections.set.UnmodifiableSortedSet;
* {@link Set} and {@link SortedSet} instances. * {@link Set} and {@link SortedSet} instances.
* *
* @since Commons Collections 2.1 * @since Commons Collections 2.1
* @version $Revision: 1.20 $ $Date: 2003/11/27 22:55:16 $ * @version $Revision: 1.21 $ $Date: 2003/12/03 11:37:44 $
* *
* @author Paul Jack * @author Paul Jack
* @author Stephen Colebourne * @author Stephen Colebourne
@ -103,7 +103,7 @@ public class SetUtils {
* An empty unmodifiable sorted set. * An empty unmodifiable sorted set.
* This is not provided in the JDK. * This is not provided in the JDK.
*/ */
public static final SortedSet EMPTY_SORTED_SET = Collections.unmodifiableSortedSet(new TreeSet()); public static final SortedSet EMPTY_SORTED_SET = UnmodifiableSortedSet.decorate(new TreeSet());
/** /**
* <code>SetUtils</code> should not normally be instantiated. * <code>SetUtils</code> should not normally be instantiated.

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/collection/CompositeCollection.java,v 1.1 2003/11/16 00:05:47 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/collection/CompositeCollection.java,v 1.2 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -61,11 +61,11 @@ import java.lang.reflect.Array;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import org.apache.commons.collections.IteratorUtils; import org.apache.commons.collections.IteratorUtils;
import org.apache.commons.collections.iterators.IteratorChain; import org.apache.commons.collections.iterators.IteratorChain;
import org.apache.commons.collections.list.UnmodifiableList;
/** /**
* Decorates a other collections to provide a single unified view. * Decorates a other collections to provide a single unified view.
@ -75,7 +75,7 @@ import org.apache.commons.collections.iterators.IteratorChain;
* strategy is provided then add and remove are unsupported. * strategy is provided then add and remove are unsupported.
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/11/16 00:05:47 $ * @version $Revision: 1.2 $ $Date: 2003/12/03 11:37:44 $
* *
* @author Brian McCallister * @author Brian McCallister
* @author Stephen Colebourne * @author Stephen Colebourne
@ -420,7 +420,7 @@ public class CompositeCollection implements Collection {
* @return Unmodifiable collection of all collections in this composite. * @return Unmodifiable collection of all collections in this composite.
*/ */
public Collection getCollections() { public Collection getCollections() {
return Collections.unmodifiableList(Arrays.asList(this.all)); return UnmodifiableList.decorate(Arrays.asList(this.all));
} }
//----------------------------------------------------------------------- //-----------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/CompositeCollection.java,v 1.2 2003/11/16 00:39:37 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/CompositeCollection.java,v 1.3 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -61,11 +61,11 @@ import java.lang.reflect.Array;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import org.apache.commons.collections.IteratorUtils; import org.apache.commons.collections.IteratorUtils;
import org.apache.commons.collections.iterators.IteratorChain; import org.apache.commons.collections.iterators.IteratorChain;
import org.apache.commons.collections.list.UnmodifiableList;
/** /**
* A <code>Collection</code> implementation that decorates other collections * A <code>Collection</code> implementation that decorates other collections
@ -76,7 +76,7 @@ import org.apache.commons.collections.iterators.IteratorChain;
* strategy is provided then add and remove are unsupported. * strategy is provided then add and remove are unsupported.
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.2 $ $Date: 2003/11/16 00:39:37 $ * @version $Revision: 1.3 $ $Date: 2003/12/03 11:37:44 $
* @deprecated TO BE REMOVED BEFORE v3.0 * @deprecated TO BE REMOVED BEFORE v3.0
* *
* @author Brian McCallister * @author Brian McCallister
@ -416,7 +416,7 @@ public class CompositeCollection implements Collection {
* @return Unmodifiable collection of all collections in this composite. * @return Unmodifiable collection of all collections in this composite.
*/ */
public Collection getCollections() { public Collection getCollections() {
return Collections.unmodifiableList(Arrays.asList(this.all)); return UnmodifiableList.decorate(Arrays.asList(this.all));
} }
//----------------------------------------------------------------------- //-----------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/OrderedSet.java,v 1.5 2003/11/16 00:39:37 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/OrderedSet.java,v 1.6 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -59,12 +59,13 @@ package org.apache.commons.collections.decorators;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.apache.commons.collections.list.UnmodifiableList;
/** /**
* Decorates a <code>Set</code> to ensure that the order of addition * Decorates a <code>Set</code> to ensure that the order of addition
* is retained and used by the iterator. * is retained and used by the iterator.
@ -82,7 +83,7 @@ import java.util.Set;
* various interface methods (notably equals/hashCode) are incompatable with a set. * various interface methods (notably equals/hashCode) are incompatable with a set.
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.5 $ $Date: 2003/11/16 00:39:37 $ * @version $Revision: 1.6 $ $Date: 2003/12/03 11:37:44 $
* @deprecated TO BE REMOVED BEFORE v3.0 * @deprecated TO BE REMOVED BEFORE v3.0
* *
* @author Stephen Colebourne * @author Stephen Colebourne
@ -155,7 +156,7 @@ public class OrderedSet extends AbstractSetDecorator implements Set {
* @return an unmodifiable list view * @return an unmodifiable list view
*/ */
public List asList() { public List asList() {
return Collections.unmodifiableList(setOrder); return UnmodifiableList.decorate(setOrder);
} }
//----------------------------------------------------------------------- //-----------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/SetList.java,v 1.4 2003/11/16 00:39:37 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/SetList.java,v 1.5 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -59,13 +59,14 @@ package org.apache.commons.collections.decorators;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Set; import java.util.Set;
import org.apache.commons.collections.set.UnmodifiableSet;
/** /**
* SetList combines the <code>List</code> and <code>Set</code> interfaces * SetList combines the <code>List</code> and <code>Set</code> interfaces
* in one implementation. * in one implementation.
@ -80,7 +81,7 @@ import java.util.Set;
* This class offers the <code>List</code> interface implementation as well. * This class offers the <code>List</code> interface implementation as well.
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.4 $ $Date: 2003/11/16 00:39:37 $ * @version $Revision: 1.5 $ $Date: 2003/12/03 11:37:44 $
* @deprecated TO BE REMOVED BEFORE v3.0 * @deprecated TO BE REMOVED BEFORE v3.0
* *
* @author Matthew Hawthorne * @author Matthew Hawthorne
@ -142,7 +143,7 @@ public class SetList extends AbstractListDecorator {
* @return an unmodifiable set view * @return an unmodifiable set view
*/ */
public Set asSet() { public Set asSet() {
return Collections.unmodifiableSet(set); return UnmodifiableSet.decorate(set);
} }
//----------------------------------------------------------------------- //-----------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/CollatingIterator.java,v 1.9 2003/09/29 22:37:40 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/CollatingIterator.java,v 1.10 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -60,12 +60,13 @@ package org.apache.commons.collections.iterators;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.BitSet; import java.util.BitSet;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.apache.commons.collections.list.UnmodifiableList;
/** /**
* Provides an ordered iteration over the elements contained in * Provides an ordered iteration over the elements contained in
* a collection of ordered {@link Iterator}s. * a collection of ordered {@link Iterator}s.
@ -75,7 +76,7 @@ import java.util.NoSuchElementException;
* <code>A.next()</code> and <code>B.next()</code>. * <code>A.next()</code> and <code>B.next()</code>.
* *
* @since Commons Collections 2.1 * @since Commons Collections 2.1
* @version $Revision: 1.9 $ $Date: 2003/09/29 22:37:40 $ * @version $Revision: 1.10 $ $Date: 2003/12/03 11:37:44 $
* *
* @author Rodney Waldhoff * @author Rodney Waldhoff
* @author Stephen Colebourne * @author Stephen Colebourne
@ -225,7 +226,7 @@ public class CollatingIterator implements Iterator {
* @return the unmodifiable list of iterators added * @return the unmodifiable list of iterators added
*/ */
public List getIterators() { public List getIterators() {
return Collections.unmodifiableList(iterators); return UnmodifiableList.decorate(iterators);
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/IteratorChain.java,v 1.6 2003/09/29 22:02:33 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/IteratorChain.java,v 1.7 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -59,10 +59,12 @@ package org.apache.commons.collections.iterators;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.apache.commons.collections.list.UnmodifiableList;
/** /**
* <p>An IteratorChain is an Iterator that wraps one or * <p>An IteratorChain is an Iterator that wraps one or
* more Iterators. When any method from the * more Iterators. When any method from the
@ -83,7 +85,7 @@ import java.util.NoSuchElementException;
* to not alter the underlying List of Iterators.</p> * to not alter the underlying List of Iterators.</p>
* *
* @since Commons Collections 2.1 * @since Commons Collections 2.1
* @version $Revision: 1.6 $ $Date: 2003/09/29 22:02:33 $ * @version $Revision: 1.7 $ $Date: 2003/12/03 11:37:44 $
* *
* @author Morgan Delagrange * @author Morgan Delagrange
* @author Stephen Colebourne * @author Stephen Colebourne
@ -211,7 +213,7 @@ public class IteratorChain implements Iterator {
* @return the unmodifiable list of iterators added * @return the unmodifiable list of iterators added
*/ */
public List getIterators() { public List getIterators() {
return Collections.unmodifiableList(iteratorChain); return UnmodifiableList.decorate(iteratorChain);
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/list/SetUniqueList.java,v 1.1 2003/11/16 00:05:47 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/list/SetUniqueList.java,v 1.2 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -59,7 +59,6 @@ package org.apache.commons.collections.list;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -68,6 +67,7 @@ import java.util.Set;
import org.apache.commons.collections.iterators.AbstractIteratorDecorator; import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
import org.apache.commons.collections.iterators.AbstractListIteratorDecorator; import org.apache.commons.collections.iterators.AbstractListIteratorDecorator;
import org.apache.commons.collections.set.UnmodifiableSet;
/** /**
* Decorates a <code>List</code> to ensure that no duplicates are present * Decorates a <code>List</code> to ensure that no duplicates are present
@ -83,7 +83,7 @@ import org.apache.commons.collections.iterators.AbstractListIteratorDecorator;
* This class offers the <code>List</code> interface implementation as well. * This class offers the <code>List</code> interface implementation as well.
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/11/16 00:05:47 $ * @version $Revision: 1.2 $ $Date: 2003/12/03 11:37:44 $
* *
* @author Matthew Hawthorne * @author Matthew Hawthorne
* @author Stephen Colebourne * @author Stephen Colebourne
@ -144,7 +144,7 @@ public class SetUniqueList extends AbstractListDecorator {
* @return an unmodifiable set view * @return an unmodifiable set view
*/ */
public Set asSet() { public Set asSet() {
return Collections.unmodifiableSet(set); return UnmodifiableSet.decorate(set);
} }
//----------------------------------------------------------------------- //-----------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/set/ListOrderedSet.java,v 1.1 2003/11/16 00:05:45 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/set/ListOrderedSet.java,v 1.2 2003/12/03 11:37:44 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -59,13 +59,13 @@ package org.apache.commons.collections.set;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.apache.commons.collections.iterators.AbstractIteratorDecorator; import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
import org.apache.commons.collections.list.UnmodifiableList;
/** /**
* Decorates another <code>Set</code> to ensure that the order of addition * Decorates another <code>Set</code> to ensure that the order of addition
@ -84,7 +84,7 @@ import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
* various interface methods (notably equals/hashCode) are incompatable with a set. * various interface methods (notably equals/hashCode) are incompatable with a set.
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/11/16 00:05:45 $ * @version $Revision: 1.2 $ $Date: 2003/12/03 11:37:44 $
* *
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Henning P. Schmiedehausen * @author Henning P. Schmiedehausen
@ -157,7 +157,7 @@ public class ListOrderedSet extends AbstractSetDecorator implements Set {
* @return an unmodifiable list view * @return an unmodifiable list view
*/ */
public List asList() { public List asList() {
return Collections.unmodifiableList(setOrder); return UnmodifiableList.decorate(setOrder);
} }
//----------------------------------------------------------------------- //-----------------------------------------------------------------------