Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // RETURNS STRING WITH ALL THE VEHICLES OF THE USER
- @Override
- public String printVehicles() {
- StringBuilder output = new StringBuilder(String.format(USER_HEADER, username));
- if (vehicles.isEmpty()) {
- output.append("\n");
- output.append(NO_VEHICLES_HEADER);
- } else {
- for (int i = 0; i < vehicles.size(); i++) {
- // PRINTING VEHICLE
- output.append("\n");
- output.append(i + 1).append(vehicles.get(i).toString());
- // PRINTING THE COMMENTS OF THE CURRENT VEHICLE
- if (vehicles.get(i).getComments().isEmpty()) {
- output.append(NO_COMMENTS_HEADER);
- } else {
- output.append(vehicles.get(i).printComments());
- }
- }
- }
- return output.toString();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement