Optional used as method argument? (original) (raw)
Sean Mullan sean.mullan at oracle.com
Fri Oct 2 13:51:46 UTC 2015
- Previous message: Optional used as method argument?
- Next message: Optional used as method argument?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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)
--Sean
- Previous message: Optional used as method argument?
- Next message: Optional used as method argument?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]