I have this:
public void log(Circle circOrig) {
...
}
And I'm trying to avoid doing this:
private void addPositions(PositionsLogger positionsLogger) {
...
Circle circ = new Circle(0,0,0); //`circ` could be final
circ.setPosition(0,0);
posLogger.log(circ);
...
}
By doing this:
public static void main(String[] args) {
...
posLogger.log(new (Circle(0, 0, 0).setPosition(0, 0)));
...
}
Which is obviously a compile error because log()
requires a Circle
, not a void
.
How can I avoid having to declare a local variable for such a trivial purpose?