Skip to content

Instantly share code, notes, and snippets.

@gabor-farkas
Created March 16, 2015 11:11
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 gabor-farkas/d59a83c2bdfe60637bf3 to your computer and use it in GitHub Desktop.
Save gabor-farkas/d59a83c2bdfe60637bf3 to your computer and use it in GitHub Desktop.
STJS variable access question
public static <T> T find(Array<T> inArray, Function1<T, Boolean> predicate) {
class X {
public T result;
public X run() {
inArray.forEach((T item) -> {
if (predicate.$invoke(item)) {
result = item;
}
});
return this;
}
}
return new X().run().result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment