Skip to content

Commit 05ec1cd

Browse files
committed
Add toInt and fromInt to fj.Ordering.
1 parent 3a5f36e commit 05ec1cd

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

core/src/main/java/fj/Ordering.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,10 @@ public enum Ordering {
2020
/**
2121
* Greater than.
2222
*/
23-
GT
23+
GT;
24+
25+
public int toInt() { return ordinal() - 1 ; }
26+
public static Ordering fromInt(int cmp) {
27+
return cmp == 0 ? EQ : cmp > 0 ? GT : LT;
28+
}
2429
}

0 commit comments

Comments
 (0)