You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Thomas Neidhart <th...@gmail.com> on 2015/05/26 22:49:24 UTC

[collections] FluentIterable

Hi,

today, I have committed a first version of a FluentIterable
(COLLECTIONS-464).

Example usage:

List<String> result =
  FluentIterable
    .of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
    .filter(new Predicate<Integer>() {
        public boolean evaluate(Integer number) {
          return number % 2 == 0;
        }
      )
    .transform(TransformerUtils.stringValueTransformer())
    .limit(3)
    .toList();

will return [2, 4, 6]

I still need to add unit tests, but I'd love to get some feedback on the
current API.

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [collections] FluentIterable

Posted by Silviu Burcea <si...@gmail.com>.
Are we going to reimplement the whole Java 8 Streams?

On Tue, May 26, 2015 at 11:49 PM, Thomas Neidhart <thomas.neidhart@gmail.com
> wrote:

> Hi,
>
> today, I have committed a first version of a FluentIterable
> (COLLECTIONS-464).
>
> Example usage:
>
> List<String> result =
>   FluentIterable
>     .of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
>     .filter(new Predicate<Integer>() {
>         public boolean evaluate(Integer number) {
>           return number % 2 == 0;
>         }
>       )
>     .transform(TransformerUtils.stringValueTransformer())
>     .limit(3)
>     .toList();
>
> will return [2, 4, 6]
>
> I still need to add unit tests, but I'd love to get some feedback on the
> current API.
>
> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
- OCPJP7 (90%)
- OCAJP7 (93%)
- Java and Big Data Enthusiast