Fluent Java library for collections: op4j

29. May, 2010

op4j is a nice little library for all those of us who need to work with collections. Here is a little example:

  Calendar now = Calendar.getInstance();
  Set<Calendar> set = 
      Op.on(list)
      .toSet()
      .map(FnString.toCalendar("dd/MM/yyyy"))
      .removeAllNullOrTrue(FnCalendar.after(now))
      .get();

That takes a list of strings, converts them to Calendar instances and removes all dates which are null or in the future. Questions?


%d bloggers like this: