> -----Original Message-----
> From: Tim Ellison [mailto:[EMAIL PROTECTED]
> 
> Nathan Beyer wrote:
> > You beat me to this update by hours -- I was holding off because I
> noticed
> > that FeatureDescriptorTest was currently an excluded test and got
> dragged
> > into that for a bit.
> 
> Sorry, didn't know that you were looking into it ... I have no emotional
> attachment, just mopping up, so you are free to go for it.
> 
> > In any case, my patch was slightly different. Instead
> > of using a Vector, I just used the 'enumeration' utility method on
> > Collections. Like this:
> >
> >     public Enumeration<String> attributeNames() {
> >         return Collections.enumeration(values.keySet());
> >     }
> >
> > The functionality is obviously equivalent. I just thought I'd comment on
> the
> > alternative.
> 
> They are not quite equivalent, since the code above enumerates over the
> actual 'values' keySet.  If code calling attributeNames() removes a
> value they are removing it from the FeatureDescriptor's private HashMap
> variable, which is probably not what we want.  Creating a new collection
> (Vector) of the values protects the code from that.
> 


The method returns an Enumeration though and there's no method for removing
items from an Enumeration.

> Regards,
> Tim
> 
> 
> >> -----Original Message-----
> >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> >> Sent: Sunday, June 11, 2006 4:16 PM
> >> To: [EMAIL PROTECTED]
> >> Subject: svn commit: r413531 -
> >>
> /incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/jav
> >> a/beans/FeatureDescriptor.java
> >>
> >> Author: tellison
> >> Date: Sun Jun 11 14:15:43 2006
> >> New Revision: 413531
> >>
> >> URL: http://svn.apache.org/viewvc?rev=413531&view=rev
> >> Log:
> >> Convert attributeNames to return an enum of strings.
> >>
> >> Modified:
> >>
> >>
> incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java
> >> /beans/FeatureDescriptor.java
> >>
> >> Modified:
> >>
> incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java
> >> /beans/FeatureDescriptor.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/mod
> >>
> ules/beans/src/main/java/java/beans/FeatureDescriptor.java?rev=413531&r1=4
> >> 13530&r2=413531&view=diff
> >>
> ==========================================================================
> >> ====
> >> ---
> >>
> incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java
> >> /beans/FeatureDescriptor.java (original)
> >> +++
> >>
> incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java
> >> /beans/FeatureDescriptor.java Sun Jun 11 14:15:43 2006
> >> @@ -24,6 +24,7 @@
> >>  import java.util.Enumeration;
> >>  import java.util.Iterator;
> >>  import java.util.StringTokenizer;
> >> +import java.util.Vector;
> >>
> >>  /**
> >>   * @author Maxim V. Berkultsev
> >> @@ -70,18 +71,10 @@
> >>      /**
> >>       * @com.intel.drl.spec_ref
> >>       */
> >> -    public Enumeration attributeNames() {
> >> -        String attributeNamesStr = "";
> >> -        Iterator i = values.keySet().iterator();
> >> -        while(i.hasNext()) {
> >> -            String attributeName = (String) i.next();
> >> -            if(attributeNamesStr.equals("")) {
> >> -                attributeNamesStr += attributeName;
> >> -            } else {
> >> -                attributeNamesStr += ' ' + attributeName;
> >> -            }
> >> -        }
> >> -        return new StringTokenizer(attributeNamesStr);
> >> +    public Enumeration<String> attributeNames() {
> >> +        Vector<String> attribNames = new
> Vector<String>(values.size());
> >> +        attribNames.addAll(values.keySet());
> >> +        return attribNames.elements();
> >>      }
> >>
> >>      /**
> >
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> --
> 
> Tim Ellison ([EMAIL PROTECTED])
> IBM Java technology centre, UK.
> 
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to