Skip to content

Instantly share code, notes, and snippets.

@fdaoud
Created May 2, 2012 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdaoud/2578036 to your computer and use it in GitHub Desktop.
Save fdaoud/2578036 to your computer and use it in GitHub Desktop.
Something something = object.getSomething();
if (something != null) {
SomeType[] someArray = something.getSomeArray();
if (someArray != null) {
for (SomeType some : someArray) {
// call f(some)
}
}
}
/*
for { a <- aa; b <- bb; c <- cc } yield c is shorthand for this:
aa bind { a => bb bind { b => cc map { c => c } } } // still nested
and a => b is shorthand for new Function1[A,B] { public B apply(A a) { return b; } }
thank you to datura
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment