-
Notifications
You must be signed in to change notification settings - Fork 18.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sleep sort #5285
base: master
Are you sure you want to change the base?
sleep sort #5285
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5285 +/- ##
============================================
+ Coverage 40.67% 40.74% +0.06%
- Complexity 2502 2509 +7
============================================
Files 519 520 +1
Lines 15447 15473 +26
Branches 2949 2953 +4
============================================
+ Hits 6283 6304 +21
- Misses 8869 8874 +5
Partials 295 295 ☔ View full report in Codecov by Sentry. |
5e02a8b
to
6e789ad
Compare
6e789ad
to
47f0a86
Compare
for (int numbers : array) { | ||
Thread thread = new Thread(() -> { | ||
try { | ||
Thread.sleep(numbers); // Sleep for 'num' milliseconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it is a good idea to throw IllegalArgumentException
, when any of the entries is negative?
79e82d2
to
9091ad8
Compare
9091ad8
to
bf2110c
Compare
@vil02 Addressed you comments ! Thanks . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just some obvious remarks. I will provide more feedback, when I will have a bit more time.
if (number < 0) { | ||
throw new IllegalArgumentException("All numbers must be non-negative. Found: " + number); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should happen, before starting any of the new threads.
List<Integer> sortedList = Collections.synchronizedList(new ArrayList<>()); | ||
List<Thread> threads = new ArrayList<>(); | ||
|
||
for (int number : array) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int number : array) { | |
for (final int number : array) { |
@vil02 Addressed you comments . |
clang-format -i --style=file path/to/your/file.java