Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save javiergamarra/7974339 to your computer and use it in GitHub Desktop.
Save javiergamarra/7974339 to your computer and use it in GitHub Desktop.
numbers = Arrays.asList(new Integer[] { 1, 2, 3, 4, 5, 6 });
numberOperations = 0;
private boolean isEven(int n) {
System.out.println(numberOperations + " - Is " + n + " even?");
numberOperations++;
return n % 2 == 0;
}
private int doubleIt(int n) {
System.out.println(numberOperations + " - we double " + n);
numberOperations++;
return n * 2;
}
private boolean isGreaterThan5(int n) {
System.out.println(numberOperations + " - Is " + n + " greater than 5?");
numberOperations++;
return n > 5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment