commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections BeanMap.java
Date Sun, 24 Mar 2002 21:53:28 GMT
mas         02/03/24 13:53:28

  Modified:    collections/src/java/org/apache/commons/collections
                        BeanMap.java
  Log:
  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.
  
  Revision  Changes    Path
  1.9       +7 -7      jakarta-commons/collections/src/java/org/apache/commons/collections/BeanMap.java
  
  Index: BeanMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/BeanMap.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BeanMap.java	21 Mar 2002 17:11:01 -0000	1.8
  +++ BeanMap.java	24 Mar 2002 21:53:27 -0000	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /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/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 @@
       /**
        * Get the keys for this BeanMap.
        * 
  -     * @return BeanMap keys.  Modifications to this Set (i.e. removes)
  -     *         <i>will</i> 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 @@
           for ( Iterator iter = valueIterator(); iter.hasNext(); ) {
               answer.add( iter.next() );
           }
  -        return answer;
  +        return Collections.unmodifiableList(answer);
       }
   
   
  
  
  

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


Mime
View raw message