This code would not compile:
if (gamepad1.left_stick_y>50) mainArm.setDirection(DIRECTION_FORWARD), mainArm.setPower(50);
// ^
Your attempt at converting multiple operations into one by placing a comma would not work:
JLS 15.27: Unlike C and C++, the Java programming language has no comma operator.
One approach is to allow changing power and direction in a single call:
if (gamepad1.left_stick_y > 50) mainArm.setDirectionAndPower(DIRECTION_FORWARD, 50);
the libraries for setting power and such are closed source
If you cannot modify the library, you can make your own helper method to address this shortcoming:
private static void setDirectionAndPower(Arm arm, Direction dir, int pow) {
arm.setDirection(dir);
arm.setPower(pow);
}
0
solved Rewriting a conditional chain as a sequence of one-liners