Two small points of feedback
Howard Lovatt
howard.lovatt at gmail.com
Fri Jan 4 13:02:51 PST 2013
Re ranges:
In my own library I use:
Range.length(10) // 0 ... 9
Range.length(1, 10) // 1 ... 10
I find this useful because:
1. You typically know size/length
2. It isn't ambiguous
Sent from my iPad
On 05/01/2013, at 1:42 AM, Stephen Colebourne <scolebourne at joda.org> wrote:
> In our regular lunchtime meeting at OpenGamma I posed two questions to
> get feedback:
>
> 1) "What does this code do"
>
> range(1, 10).forEach( (i) -> System.out.println(i) );
>
> First response "if that doesn't print 1 to 10 then someone needs their
> head examining" (someone working in multiple languages more focussed
> on maths than Java coding)
> Second responses "suppose it might depend"/"have to check docs" (Java
> developers)
>
> Personally, I think that while it can be explained/documented that it
> is a half-open range, it reads far better in code as a closed range.
>
>
> 2) "Which of these corresponds to IntFunction"
>
> (int) -> T
> (T) -> int
>
> Response chose the first (whereas the codebase has the second).
>
> Personally I would choose the first (and use FuncInt, FunctionInt,
> CalcInt, CalculatorInt or IntCalculator for the second).
>
> (poll highly unscientific, respondents had limited/no exposure to
> lambdas, yada yada yada)
> Stephen
>
More information about the lambda-dev
mailing list