-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
There is a nice project here that allows to have operator overloading support.
It is basic but still a huge step for java devs.
There are some drawbacks though at the moment:
Map<String, String> binary = new HashMap<String, String>() {{
put("+", "add");
put("-", "subtract");
put("*", "multiply");
put("/", "divide");
put("%", "remainder");
put("&", "and");
put("|", "or");
put("^", "xor");
put("<<", "shiftLeft");
put(">>", "shiftRight");
put("<", compareTo);
put(">", compareTo);
put("<=", compareTo);
put(">=", compareTo);
}};
String revSuffix = "Rev";
Map<String, String> unary = new java.util.HashMap<String, String>() {{
put("-", "negate"); // jdk7
put("---", "negate"); // jdk8
put("~", "not");
}};
String compareTo = "compareTo";
String indexGet = "get";
String[] indexSet = new String[]{"set", "put"};
String[] valueOf = new String[]{"valueOf", "of"};Metadata
Metadata
Assignees
Labels
No labels