File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ public boolean isGreaterThan(final A a1, final A a2) {
129129 * @return A function that returns true if its argument is less than the argument to this method.
130130 */
131131 public F <A , Boolean > isLessThan (final A a ) {
132- return compose (o -> o != Ordering .LT , f .f (a ));
132+ return compose (o -> o == Ordering .GT , f .f (a ));
133133 }
134134
135135 /**
@@ -139,7 +139,7 @@ public F<A, Boolean> isLessThan(final A a) {
139139 * @return A function that returns true if its argument is greater than the argument to this method.
140140 */
141141 public F <A , Boolean > isGreaterThan (final A a ) {
142- return compose (o -> o != Ordering .GT , f .f (a ));
142+ return compose (o -> o == Ordering .LT , f .f (a ));
143143 }
144144
145145 /**
Original file line number Diff line number Diff line change 1+ package fj ;
2+
3+ import org .junit .Test ;
4+
5+ import static org .hamcrest .CoreMatchers .is ;
6+ import static org .hamcrest .MatcherAssert .assertThat ;
7+
8+ public class OrdTest {
9+
10+ @ Test
11+ public void isGreaterThan () {
12+ F <Long , Boolean > pred = Ord .longOrd .isGreaterThan (1L );
13+
14+ assertThat (pred .f (0L ), is (false ));
15+ assertThat (pred .f (1L ), is (false ));
16+ assertThat (pred .f (2L ), is (true ));
17+ }
18+
19+ @ Test
20+ public void isLessThan () {
21+ F <Long , Boolean > pred = Ord .longOrd .isLessThan (1L );
22+
23+ assertThat (pred .f (0L ), is (true ));
24+ assertThat (pred .f (1L ), is (false ));
25+ assertThat (pred .f (2L ), is (false ));
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments