Most elegant way to apply an operator found as a string in java ?
- by LB
Potentially dumb:
Assuming I have a string containing an operator what's the best way to apply this operator ?
What i tend to do is :
if(n.getString(1).equals("<<")) {
result = tmp1 << tmp2;
}
for each kind of operator I have. Is there a better way ?