Loose end: ints(), longs()

Brian Goetz brian.goetz at oracle.com
Tue May 28 11:25:49 PDT 2013


Separating....

There are at least three votes for treating "boxed" separately.

Orthogonal to that is how we name the remaining primitive conversion 
methods.  There is unfortunately no consistent rule for differentiating 
asXxx from toXxx, but we do try to lean towards: use asXxx when the 
transformation is a "lightweight" or lazy one (Arrays.asList provides a 
lazy List view of an array, rather than populating a new ArrayList) 
whereas toXxx performs a more expensive and eager transformation. 
Obviously exceptions abound, but this guideline strongly suggests 
"asXxxStream" over "toXxxStream".  Which I don't think the toXxxStream 
contingent will object to?

So combining the votes received thus far, seems like the equilibrium is:

   boxed()
   as{Int,Long,Double}Stream

?

On 5/28/2013 2:16 PM, Tim Peierls wrote:
> On Tue, May 28, 2013 at 2:05 PM, Brian Goetz <brian.goetz at oracle.com
> <mailto:brian.goetz at oracle.com>> wrote:
>
>     There seems to be broad support behind renaming the existing xxxs()
>     methods.  Though there now are almost as many proposals as there are
>     EG members :(
>
>     as{Ints,Longs,Boxed}
>     as{Ints,Longs,Objs} // most consistent with map/flatMap naming
>     as{Ints,Longs} but keep boxed()
>     to{Int,Long}Stream but keep boxed()
>
>
> The variety isn't necessarily a sign of strong disagreement. I don't
> think any of these are unworkable, but I do have a preference for the
> last one -- toIntStream(), toLongStream(), and boxed() -- because those
> names seem less prone to misinterpretation than in the other cases.
>
> --tim


More information about the lambda-libs-spec-observers mailing list