Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I'd implements Runnable than extends Thread implements Runnable than extends Thread and change the following loop

  1. Unfortunately, the code is still not thread safe. Although accessing array elements on separate threads could be safe accessing array elements on separate threads could be safe but the code in the question accesses the same array index from separate threads which should be synchronized properly.

This is duplicated in the code. You should move this logic into a separate method and use that to keep it DRY. Additionally, I guess the format of Arrays.toString won't change but it would be cleaner iterating through the array and building the string with a loop or using an already existing join implementation building the string with a loop or using an already existing join implementation.

I'd implements Runnable than extends Thread and change the following loop

  1. Unfortunately, the code is still not thread safe. Although accessing array elements on separate threads could be safe but the code in the question accesses the same array index from separate threads which should be synchronized properly.

This is duplicated in the code. You should move this logic into a separate method and use that to keep it DRY. Additionally, I guess the format of Arrays.toString won't change but it would be cleaner iterating through the array and building the string with a loop or using an already existing join implementation.

I'd implements Runnable than extends Thread and change the following loop

  1. Unfortunately, the code is still not thread safe. Although accessing array elements on separate threads could be safe but the code in the question accesses the same array index from separate threads which should be synchronized properly.

This is duplicated in the code. You should move this logic into a separate method and use that to keep it DRY. Additionally, I guess the format of Arrays.toString won't change but it would be cleaner iterating through the array and building the string with a loop or using an already existing join implementation.

replaced http://ux.stackexchange.com/ with https://ux.stackexchange.com/
Source Link

Error messages shouldn't blame the user (don't say what he did is wrong), give a suggestion about what they should do. (See: Should we avoid negative words when writing error messages?, What will be the Best notifications and error messages?)

Error messages shouldn't blame the user (don't say what he did is wrong), give a suggestion about what they should do. (See: Should we avoid negative words when writing error messages?, What will be the Best notifications and error messages?)

replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
Source Link
added 871 characters in body
Source Link
palacsint
  • 30.3k
  • 9
  • 82
  • 157
Loading
Source Link
palacsint
  • 30.3k
  • 9
  • 82
  • 157
Loading
lang-java

AltStyle によって変換されたページ (->オリジナル) /