import java.util.*; public class Move { private Velocity velocity; private Map.Entry<Double, Double> value; public Move(Velocity velocity) { this.velocity = velocity; } public void moveX(double x) { this.value = new AbstractMap.SimpleEntry<>(x, this.value.getValue()); velocity.updateByMove(value); } public void moveY(double y) { this.value = new AbstractMap.SimpleEntry<>(this.value.getKey(), y); } public Map.Entry<Double, Double> getValue() { return value; } }