commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "K.C. Baltz" <kc.ba...@lollimail.com>
Subject Re: [COLLECTIONS] How should PredicatedCollections work?
Date Sun, 20 Jul 2003 23:56:47 GMT
Thanks for making the change.  However, I'm not sure you changed 
enough.  I still find the Javadoc confusing.  The issue for me is that 
it doesn't say anything about the constraint that the original 
collection must contain only elements that match the predicate.  The 
line, "Only objects that pass the test in the given predicate can be 
added to the collection" only tells me that after I call 
predicatedCollection, I will not be able to added non-matching objects 
the collection.

You might even consider adding a @see for the filterCollection method as 
that's what I really wanted when I originally found 
predicatedCollection.  Also, any javadoc changes you make should 
probably be added to ListUtils as well.

Thanks,
K.C.

Stephen Colebourne wrote:

>I've improved the CVS HEAD javadoc a little. Thanks
>Stephen
>
>----- Original Message -----
>From: "K.C. Baltz" <kc.baltz@lollimail.com>
>To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
>Sent: Friday, July 18, 2003 6:02 PM
>Subject: Re: [COLLECTIONS] How should PredicatedCollections work?
>
>
>  
>
>>At least I'm not going crazy.  Perhaps the Javadoc could be made
>>clearer.  May I suggest for Collection.predicatedCollection:
>>
>>* @param collection - the collection to predicate, must not be null.
>>All elements must pass the test in the predicate
>>
>>and
>>
>>* @throws IllegalStateException If one of the elements in
>><code>collection</code> does not pass the predicate test.
>>
>>K.C.
>>
>>    
>>
>>>PredicatedList exists to filter input to a collection by blocking invalid
>>>      
>>>
>elements. A typical example is to create a LIst that only allows an object
>of a specific type.
>  
>
>>>What you want is FilteredList. Unfortunately, that doesn't exist in
>>>      
>>>
>[collections]. I'd like to add it, but time limits me. If you want to write
>a version (based on the CVS HEAD code) please feel free.
>  
>
>>>Stephen
>>>
>>>
>>>
>>>      
>>>
>>>>from:    "K.C. Baltz" <kc.baltz@lollimail.com>
>>>>
>>>>I tried to use a Predicated List today (ListUtils.predicatedList)  and
>>>>it didn't work the way I expected.  What I wanted to do was pass it a
>>>>list of items and a Predicate such that it would "filter" the list for
>>>>me and the new list would only contain those items that match the
>>>>predicate.  However, I received an IllegalStateException because items
>>>>in my list didn't match the Predicate.  What is the point of the
>>>>predicated list if it does this?
>>>>
>>>>K.C.
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>  
>


Mime
View raw message