Conversation
arturobernalg
commented
Jan 25, 2021
- Use Empty collections
- Unnecessary boxing
- Unnecessary toString
- Use Math.max
| /** | ||
| * An empty immutable {@code NameValuePair} array. | ||
| */ | ||
| public static final NameValuePair[] EMPTY_NAME_VALUE_PAIR_ARRAY = new NameValuePair[0]; |
There was a problem hiding this comment.
@arturobernalg There is no need to make it public. Please change to private.
89d67d5 to
7fc219c
Compare
| /** | ||
| * An empty immutable {@code NameValuePair} array. | ||
| */ | ||
| public static final NameValuePair[] EMPTY_NAME_VALUE_PAIR_ARRAY = new NameValuePair[0]; |
|
|
||
| return new HttpServer( | ||
| this.listenerPort > 0 ? this.listenerPort : 0, | ||
| Math.max(this.listenerPort, 0), |
There was a problem hiding this comment.
@arturobernalg What are benefits of using Math#max here? Is it more byte code efficient? I am kind of old and stupid. It makes it more difficult for me to understand the intent of the operation. I am also a bit worried that the proposed code appears to make no distinction between greater and greater equal (as well lesser and lesser equal) comparison operations.
There was a problem hiding this comment.
@arturobernalg What are benefits of using
Math#maxhere? Is it more byte code efficient? I am kind of old and stupid. It makes it more difficult for me to understand the intent of the operation. I am also a bit worried that the proposed code appears to make no distinction between greater and greater equal (as well lesser and lesser equal) comparison operations.
HI @ok2c
My idea was get more readability. As far as I know for implementation/performance sake, they would be nearly equivalent. Maybe a bit more faster the java implementations. But your right, no make no distinction between greater and greater equal. I gonna remove that changes.
* Use Empty collections * Unnecessary boxing * Unnecessary toString
99507c3 to
168907d
Compare