Streams arrays and getFirst()

Jose jgetino at
Mon Aug 13 04:18:40 PDT 2012

To use arrays as inputs for lambda pipelines I'm currentely using:


I'm also testing to refractor some methods in my code 

T  foo(List list){}                  to     T foo(Iterable iter)

If the foo() body needs the first element of the iterable,  I can provide it
with the extension method:


However I thik that this method could do better in the array case, because
now it is not checking if the passed argument is a List. 

For example, another method in the class


already check for the argument being a Collection and then returns its size,
no need to compute it. 

Would you mind to include the List check in getFirst()?

More information about the lambda-dev mailing list