[ 
https://issues.apache.org/jira/browse/PIVOT-799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13971660#comment-13971660
 ] 

Roger Whitcomb commented on PIVOT-799:
--------------------------------------

So, that's good.  My actual use case was this:
* Construct an empty Pivot Collections List
* Add a (possibly translated) string for "Default" to the Pivot List
* Add all the elements of another java.util.List of valid font names in a loop 
doing "add" to the Pivot List
* Use the Pivot List as the data for a ListButton.

With this constructor it simply becomes this:
* Construct a new Pivot Collections List from the java.util.List of font names
* Insert the "Default" string at index 0
* Use the list as data for the ListButton

So, several lines less code and much faster since we don't have the overhead of 
multiple (maybe 100s) of adds to the Pivot list.

But, along the lines of the companion classes, I was wondering if we could 
create some generic factory methods that would automatically wrap things in a 
ListAdapter or MapAdapter using generics.  Not sure exactly what that would 
look like, though.  Is this kind of what you were thinking?

> extending Pivot collections
> ---------------------------
>
>                 Key: PIVOT-799
>                 URL: https://issues.apache.org/jira/browse/PIVOT-799
>             Project: Pivot
>          Issue Type: Improvement
>          Components: core-collections
>            Reporter: Sandro Martini
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.5, 2.1
>
>         Attachments: Monad_sample_revised.groovy
>
>
> Add some usuful methods to Pivot Collections like those needed to process all 
> elements, going more "function style", like addAll, contains, etc ...
> To simplify usage from people coming from other languages, try to align to 
> other languages names/conventions (for what is possible) , like Scala, C# .
> Verify even if add a interface (defining a single method) that could be 
> passed to some methods to contain logic for processing all elements (like the 
> apply() in Scala), and chose a right name for it (maybe function or other 
> similar).
> Some info here:
> http://apache-pivot-developers.417237.n3.nabble.com/Some-idea-on-extending-Pivot-collections-td3321472.html
> But for more changes in Collections (still to be discussed), wait the 3.0 ...



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to