Skip to content

Commit

Permalink
submit java-oop-ru/interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
hexlet-cli committed Sep 24, 2024
1 parent c7ebf66 commit aa6a561
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions java-oop-ru/interfaces/src/main/java/exercise/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
import java.util.List;
import java.util.stream.Collectors;

public static List<String> buildApartmentsList(List<Home> homes, int n) {
List<String> homesList = new ArrayList<>();
public class App {
public static List<String> buildApartmentsList(List<Home> homes, int n) {
List<String> homesList = new ArrayList<>();

// Сортируем список объектов по площади по возрастанию
Collections.sort(homes);
// Сортируем список объектов по площади по возрастанию
Collections.sort(homes);

// Берем первые n элементов
List<Home> firstHomes = homes.subList(0, Math.min(n, homes.size()));
// Берем первые n элементов
List<Home> firstHomes = homes.subList(0, Math.min(n, homes.size()));

// Создаем список строковых представлений объектов
for (Home home : firstHomes) {
homesList.add(home.toString());
}

return homesList;
// Создаем список строковых представлений объектов
for (Home home : firstHomes) {
homesList.add(home.toString());
}

return homesList;
}
4 changes: 2 additions & 2 deletions java-oop-ru/interfaces/src/main/java/exercise/Cottage.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ else if (area > another.getArea()) {
}

@Override
public toString() {
return floorCount + "этажный коттедж площадью" + area "метров";
public String toString() {
return floorCount + "этажный коттедж площадью" + area + "метров";
}
}
2 changes: 1 addition & 1 deletion java-oop-ru/interfaces/src/main/java/exercise/Flat.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ else if (this.getArea() > another.getArea()) {
}

@Override
public toString() {
public String toString() {
return "Квартира площадью" + this.getArea() + "метров на" + floor + "этаже";
}

Expand Down

0 comments on commit aa6a561

Please sign in to comment.