Hi.

On Fri, 29 Dec 2017 11:53:29 -0200, Lucas Carvalho wrote:
I`m sorry,

Now code in "text":

public static boolean between(final int value, final int x, final int y) {

   return value >= x && value <= y;

}


public static boolean between(final short value, final short x, final short
y) {

   return value >= x && value <= y;

}

To comply with the Java convention, it should probably be "isBetween".

Incidently, this also shows a weakness of "Utils" classes: the "target"
(which would normally be "this") is on the same footing as the other
arguments (the bounds of the interval here).

Also the naming does not reflect whether bounds are included or not:
usually, one would assume that the left bound is included (>=) but not
the right one (<).

Then, what about "between(15, 20, 10)"?

Finally, we should consider whether to continue bloating "NumberUtils"
in "Lang" or move some of it to the new "Numbers" component.[1]

Regards,
Gilles

[1] https://git1-us-west.apache.org/repos/asf?p=commons-numbers.git;a=tree




Obrigado.

Atenciosamente

Lucas Carvalho

*Fone *- 34 9 9903 4621

On Fri, Dec 29, 2017 at 11:47 AM, Gilles <gil...@harfang.homelinux.org>
wrote:

Hi.

On Fri, 29 Dec 2017 09:51:59 -0200, Lucas Carvalho wrote:

Hello everybody,

I want know if the feature "between" in NumberUtils lib has be discussed?
I
use this methods a lot and i would like to share this code in apache
commons.

Below i share a example:

[image: Inline image 1]


All I can see is the above.
[Perhaps the image was stripped.]

I assume it is code; so, please write it here as "text".

Thanks,
Gilles


Thanks.

Lucas Carvalho




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to