Skip to content

Instantly share code, notes, and snippets.

@framiere
Created March 18, 2011 18:46
Show Gist options
  • Save framiere/876610 to your computer and use it in GitHub Desktop.
Save framiere/876610 to your computer and use it in GitHub Desktop.
funky comparator
class Sort extends Comp<Person> {{r = t1.getName().compareTo(t2.getName());}}
List<Person> sortedPersons = from(with(Sort.class)).sortedCopy(asList(john, joe));
class Price extends Func<Integer, String> {{ t = f+"$"; }};
List<String> prices = transform(values, with(Price.class));
class Adult extends Pred<Integer> {{r = t > 18;}};
List<Integer> adults = newArrayList(filter(values, with(Adult.class)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment