Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. {---------------- ! -----------------------------}
  2. public boolean isBetween(Key fromKey, Key toKey) {
  3. if (fromKey.compareTo(toKey) < 0) {
  4. if (this.compareTo(fromKey) > 0 && this.compareTo(toKey) < 0) {
  5. return true;
  6. }
  7. } else if (fromKey.compareTo(toKey) > 0) {
  8. if (this.compareTo(toKey) > 0 || this.compareTo(fromKey) > 0) {
  9. return true;
  10. }
  11. }
  12. return false;
  13. }
  14.  
  15. {--------------- 2 ------------------------------>
  16. public boolean isBetween(Key fromKey, Key toKey) {
  17. if (fromKey.compareTo(toKey) < 0) {
  18. if (this.compareTo(fromKey) > 0 && this.compareTo(toKey) < 0) {
  19. return true;
  20. }
  21. } else if (fromKey.compareTo(toKey) > 0) {
  22. if (this.compareTo(toKey) < 0 || this.compareTo(fromKey) > 0) {
  23. return true;
  24. }
  25. }
  26. return false;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement