From 2182a43da2f211c7c696cf2f4d2c7d2d9a865c5e Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Mon, 3 May 2004 15:13:05 +0000 Subject: [PATCH] Fix to ensure unmodifiable git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131696 13f79535-47bb-0310-9956-ffa450edef68 --- .../collections/bag/UnmodifiableSortedBag.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java b/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java index c41685f5c..dd83dadfa 100644 --- a/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java +++ b/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java @@ -17,16 +17,18 @@ package org.apache.commons.collections.bag; 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 SortedBag to ensure it can't be altered. * * @since Commons Collections 3.0 - * @version $Revision: 1.6 $ $Date: 2004/02/18 00:56:25 $ + * @version $Revision: 1.7 $ $Date: 2004/05/03 15:13:05 $ * * @author Stephen Colebourne */ @@ -86,4 +88,18 @@ public final class UnmodifiableSortedBag 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); + } + }