Let's say the method foo() has lot of code and it also includes doing something for bar1, bar2 and bar3, maybe setting some status or print something or something else which is being done in just one line (note that bar1(), bar2() and bar3() are not getter/setter of that class).
The question is what would the preferred way to do this in java - are those methods ok to have just one line or remove those tiny methods and include those code in method foo() ?
class Test {
public void foo() {
bar1();
bar2();
bar3();
// rest of the code goes here...
}
private void bar1() {
// do something for bar1
}
private void bar2() {
// do something for bar2
}
private void bar3() {
// do something for bar3
}
}