62 ps.sc = serviceClass.Economy;
63 SeatSet.economyClassPassengers[j][i] = ps;
64 return true;
65 } else if (ps.sp.equals(seatPosition.C) && (i == 1 || i == 4)) { 66 ps.sc = serviceClass.Economy; 67 SeatSet.economyClassPassengers[j][i] = ps; 68 return true; 69 } else if (ps.sp.equals(seatPosition.W) && (i == 0 || i == 5)) { 70 ps.sc = serviceClass.Economy;
71 SeatSet.economyClassPassengers[j][i] = ps;
72 return true;
This method seems to have the same code for multiple branch statements.
This could be a valid usage for clarity's sake, but it might also indicate a typo.
if (someCondition) {
System.out.println("a");
System.out.println(1 + new Random().nextInt());
} else if (someOtherCondition) { // The else if block has the same content as the first if block...
System.out.println("a");
System.out.println(1 + new Random().nextInt());
} else if (new Random().nextBoolean()) {
if ("3".equals("4")) System.out.println(3 + new Random().nextInt());
}
If the duplication was intended, consider just combining the conditions with an OR operator:
if (someCondition || someOtherCondition) {
System.out.println("a");
System.out.println(1 + new Random().nextInt());
}