Optional used as method argument?
Wang Weijun
weijun.wang at oracle.com
Fri Oct 2 14:20:10 UTC 2015
> 在 2015年10月2日,下午9:51,Sean Mullan <sean.mullan at oracle.com> 写道:
>
>
>
> On 10/2/15 9:27 AM, Wang Weijun wrote:
>>
>>> 在 2015年10月2日,下午8:49,Roger Riggs <Roger.Riggs at oracle.com> 写道:
>>>
>>> +1
>>>
>>> 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)
Accepted.
Thanks
Max
>
> --Sean
More information about the core-libs-dev
mailing list