Skip to content

Проектная работа №1#1

Open
VadimBoz wants to merge 2 commits intomainfrom
dev
Open

Проектная работа №1#1
VadimBoz wants to merge 2 commits intomainfrom
dev

Conversation

@VadimBoz
Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/main/java/Car.java
Comment thread src/main/java/Racing.java
import java.util.ArrayList;

public class Racing {
private final ArrayList<Car> cars = new ArrayList<>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

От хранения массива машин и лишнего цикла при определении победителя можно избавиться, если при вводе данных сразу вычислять победителя и хранить его в отдельной переменной, тогда программа будет требовать меньше памяти и работать быстрее

Comment thread src/main/java/Racing.java
}

for (int i = 1; i < 24; i++) {
Thread.sleep(200);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В данном случае ОК для имитации загрузки, но на будущее - лучше Thread.sleep не использовать, так как это блокирует поток, что плохо сказывается на производительности

Repository owner deleted a comment from ArturNurtdinov Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants