import java.util.List; class C { List x; List y; private void foo() { if (x.isEmpty()) return; x.remove(0); y.add(str()); baz(); } private void bar() { if (y.isEmpty()) return; y.remove(0); x.add(str()); baz(); } private void baz() { } private String str() { return null; } }