incubator-adffaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeanne Waldman <jeanne.wald...@oracle.com>
Subject Re: return an Iterator vs a List
Date Thu, 05 Apr 2007 20:28:13 GMT
This is the case. It is really to use the fun new "for" syntax. At least 
for now.
- Jeanne

Simon Lessard wrote:
> In that specific case Iterable would be nice yeah.
>
> On 4/5/07, Matthias Wessendorf <matzew@apache.org> wrote:
>>
>> +1
>>
>> On 4/5/07, Adam Winer <awiner@gmail.com> wrote:()
>> > If the only reason is to enable the fun new "for" syntax,
>> > then we should change the type from Iterator to Iterable,
>> > instead of List.  List is a much larger contract.
>> >
>> > -- Adam
>> >
>> >
>> > On 3/28/07, Jeanne Waldman <jeanne.waldman@oracle.com> wrote:
>> > > Hi there,
>> > > I'm in the Skinning StyleNode code and I see that the 'get' methods
>> > > return Iterators
>> > > from the good ol' days.
>> > > It seems to me that it is better if they just return Lists so the 
>> code
>> > > that iterates over
>> > > the values is cleaner using 5.0's for(String foo : yyy) construct.
>> > > Does anyone see why I wouldn't want these to return List instead of
>> > > Iterator?
>> > >
>> > > Here's a code snippet. Thanks, Jeanne
>> > > --
>> > >
>> > >   public Iterator<IncludePropertyNode> getIncludedProperties()
>> > >   {
>> > >     if(_includedProperties == null)
>> > >     {
>> > >       List<IncludePropertyNode> list = Collections.emptyList();
>> > >       return list.iterator();
>> > >     }
>> > >     else
>> > >       return (Arrays.asList(_includedProperties)).iterator();
>> > >   }
>> > >
>> > >   /**
>> > >    * Gets the properties specified by this node's parent that should
>> be
>> > >    * ignored. This method will return an empty iterator if
>> > >    * {@link #isInhibitingAll()} returns <code>true</code>
>> > >    *
>> > >    * @return an iterator over the properties that should be ignored,
>> an
>> > >    *         empty iterator if all properties should be.
>> > >    */
>> > >   public Iterator<String> getInhibitedProperties()
>> > >   {
>> > >     if(_inhibitedProperties == null)
>> > >     {
>> > >       List<String> list = Collections.emptyList();
>> > >       return list.iterator();
>> > >     }
>> > >     else
>> > >     {
>> > >       return _inhibitedProperties.iterator();
>> > >     }
>> > >   }
>> > >
>> >
>>
>>
>> -- 
>> Matthias Wessendorf
>> http://tinyurl.com/fmywh
>>
>> further stuff:
>> blog: http://jroller.com/page/mwessendorf
>> mail: mwessendorf-at-gmail-dot-com
>>
>

Mime
View raw message