You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2004/05/03 17:13:05 UTC

cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/bag UnmodifiableSortedBag.java

scolebourne    2004/05/03 08:13:05

  Modified:    collections/src/java/org/apache/commons/collections/bag
                        UnmodifiableSortedBag.java
  Log:
  Fix to ensure unmodifiable
  
  Revision  Changes    Path
  1.7       +17 -1     jakarta-commons/collections/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java
  
  Index: UnmodifiableSortedBag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- UnmodifiableSortedBag.java	18 Feb 2004 00:56:25 -0000	1.6
  +++ UnmodifiableSortedBag.java	3 May 2004 15:13:05 -0000	1.7
  @@ -17,10 +17,12 @@
   
   import java.util.Collection;
   import java.util.Iterator;
  +import java.util.Set;
   
   import org.apache.commons.collections.SortedBag;
   import org.apache.commons.collections.Unmodifiable;
   import org.apache.commons.collections.iterators.UnmodifiableIterator;
  +import org.apache.commons.collections.set.UnmodifiableSet;
   
   /**
    * Decorates another <code>SortedBag</code> to ensure it can't be altered.
  @@ -84,6 +86,20 @@
   
       public boolean retainAll(Collection coll) {
           throw new UnsupportedOperationException();
  +    }
  +
  +    //-----------------------------------------------------------------------
  +    public boolean add(Object object, int count) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public boolean remove(Object object, int count) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public Set uniqueSet() {
  +        Set set = getBag().uniqueSet();
  +        return UnmodifiableSet.decorate(set);
       }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org