Optional used as method argument?
sean.mullan at oracle.com
Fri Oct 2 13:51:46 UTC 2015
On 10/2/15 9:27 AM, Wang Weijun wrote:
>> 在 2015年10月2日，下午8:49，Roger Riggs <Roger.Riggs at oracle.com> 写道：
>> The "no such value" makes me curious about the context.
>> The @param tag really should be saying something about the parameter.
> In fact, I'm working on a method which is similar to
> * Generates some random bytes.
> * @param n requested random value in bytes.
> * @param extraEntropy optional entropy caller can provide, null if none.
> byte getRandom(int n, byte extraEntropy)
> Most caller won't be able to provide extra entropy, but if one does have a dedicated device which can generate fresh entropy, it is welcome.
Alternatively, you could just add an overloaded method, and not allow a
null value for extraEntropy:
byte getRandom(int n)
byte getRandom(int n, byte extraEntropy)
More information about the core-libs-dev