From 63cf00bf0e331ab087a6a3180df02d0c20b3dc56 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sun, 24 Mar 2002 21:53:27 +0000 Subject: [PATCH] Made BeanMap.values() and BeanMap.keySet() unmodifiable. This brings it more in line with the Map contract where any modifications will throw UnsupportedOperationException rather than allow modifications that are not reflected in the underlying map. This also keeps values(), keySet() and entrySet() consistent with each other. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130673 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/collections/BeanMap.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/commons/collections/BeanMap.java b/src/java/org/apache/commons/collections/BeanMap.java index 48f61e04a..4d6d2b320 100644 --- a/src/java/org/apache/commons/collections/BeanMap.java +++ b/src/java/org/apache/commons/collections/BeanMap.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/BeanMap.java,v 1.8 2002/03/21 17:11:01 morgand Exp $ - * $Revision: 1.8 $ - * $Date: 2002/03/21 17:11:01 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/BeanMap.java,v 1.9 2002/03/24 21:53:27 mas Exp $ + * $Revision: 1.9 $ + * $Date: 2002/03/24 21:53:27 $ * * ==================================================================== * @@ -342,11 +342,11 @@ public class BeanMap extends AbstractMap implements Cloneable { /** * Get the keys for this BeanMap. * - * @return BeanMap keys. Modifications to this Set (i.e. removes) - * will be reflected in the BeanMap. + * @return BeanMap keys. The Set returned bu this method is not + * modifiable. */ public Set keySet() { - return readMethods.keySet(); + return Collections.unmodifiableSet(readMethods.keySet()); } /** @@ -396,7 +396,7 @@ public class BeanMap extends AbstractMap implements Cloneable { for ( Iterator iter = valueIterator(); iter.hasNext(); ) { answer.add( iter.next() ); } - return answer; + return Collections.unmodifiableList(answer); }