作者AmosYang (LetMeGoogleThatForYou)
看板java
标题Re: [问题] Wrapping/Widening + Var-args
时间Thu Sep 9 11:50:07 2010
※ 引述《tkcn (小安)》之铭言:
: 而因为这个 bug 的 priority 是 Vary Low,
: 所以拖了近六年至今还没被处理掉....XD
http://download.oracle.com/javase/1.5.0/docs/guide/language/varargs.html
So when should you use varargs? As a client, you should take advantage
of them whenever the API offers them. Important uses in core APIs
include reflection, message formatting, and the new printf facility.
As an API designer, you should use them sparingly, only when the benefit
is truly compelling.
Generally speaking, you should not overload a varargs
method, or it will be difficult for programmers to figure out which
overloading gets called.
Translation 1: Just because you can, it doesn't necessarily mean you should.
Translation 2: Don't f* do it.
XD
If anyone's interested in this sort of (fun) stuff, read Eric Lippert's
blog. It's full of this kind of (fun) stuff. ;)
http://blogs.msdn.com/b/ericlippert/
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 65.87.177.87