Created
February 23, 2016 08:08
-
-
Save paddyzab/6dd5e76d3333894b2efd to your computer and use it in GitHub Desktop.
Two helper methods to improve semantics of range comparison.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean isOutsideRange(int i, int lowerBound, int upperBound) { | |
return (i < lowerBound || upperBound < i); | |
} | |
private boolean isInsideRange(int i, int lowerBound, int upperBound) { | |
return (i < lowerBound && upperBound < i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment