Aug 18
Tom McQueeney has been playing with varargs.
It will definitely be interesting to see how often people use varargs in their designs… especially code APIs. As with everything, hopefully they won’t be overused.
When you see examples such as:
public Person(String... params) { lastName = firstName = middleName = nickName = ""; if (params.length > 0) lastName = params[0]; if (params.length > 1) firstName = params[1]; if (params.length > 2) middleName = params[2]; if (params.length > 3) nickName = params[3]; if (params.length > 4) { throw new IllegalArgumentException( "Constructor called with too many arguments" ); } }
it gets a little scary. How often will someone pass in “Almaer”, “Dion” instead of “Dion”, “Almaer”. Tom points out this issue himself
Named parameters please :) :)
October 10th, 2006 at 10:17 pm
http://sharewareriver.com/products/29511.htm
- http://sharewareriver.com/products/29512.htm
- http://sharewareriver.com/products/29513.htm
- http://sharewareriver.com/products/29514.htm
- http://sharewareriver.com/products/29515.htm
- http://sharewareriver.com/products/29516.htm
- http://sharewareriver.com/products/29517.htm
- http://sharewareriver.com/products/29518.htm
- http://sharewareriver.com/products/29519.htm
- http://sharewareriver.com/products/29520.htm
- http://sharewareriver.com/products/29521.htm
- http://sharewareriver.com/products/29522.htm
- http://sharewareriver.com/products/29523.htm
- http://sharewareriver.com/products/29524.htm
- http://sharewareriver.com/products/29525.htm
- http://sharewareriver.com/products/29526.htm
- http://sharewareriver.com/products/29527.htm
- http://sharewareriver.com/products/29528.htm
- http://sharewareriver.com/products/29529.htm
- http://sharewareriver.com/products/29530.htm
- http://sharewareriver.com/products/29531.htm
- http://sharewareriver.com/products/29532.htm
- http://sharewareriver.com/products/29533.htm
- http://sharewareriver.com/products/29534.htm
- http://sharewareriver.com/products/29535.htm
- http://sharewareriver.com/products/29536.htm
- http://sharewareriver.com/products/29537.htm
- http://sharewareriver.com/products/29538.htm
- http://sharewareriver.com/products/29539.htm
- http://sharewareriver.com/products/29540.htm
- http://sharewareriver.com/products/29541.htm
- http://sharewareriver.com/products/29542.htm
- http://sharewareriver.com/products/29543.htm
- http://sharewareriver.com/products/29544.htm
- http://sharewareriver.com/products/29545.htm
- http://sharewareriver.com/products/29546.htm
- http://sharewareriver.com/products/29547.htm
- http://sharewareriver.com/products/29548.htm
- http://sharewareriver.com/products/29549.htm
- http://sharewareriver.com/products/29550.htm
- http://sharewareriver.com/products/29551.htm
- http://sharewareriver.com/products/29552.htm
- http://sharewareriver.com/products/29553.htm
- http://sharewareriver.com/products/29554.htm
- http://sharewareriver.com/products/29555.htm
- http://sharewareriver.com/products/29556.htm
- http://sharewareriver.com/products/29557.htm
- http://sharewareriver.com/products/29558.htm
- http://sharewareriver.com/products/29559.htm
- http://sharewareriver.com/products/29560.htm
- http://sharewareriver.com/products/29561.htm
- http://sharewareriver.com/products/29562.htm
- http://sharewareriver.com/products/29563.htm
- http://sharewareriver.com/products/29564.htm
- http://sharewareriver.com/products/29565.htm
- http://sharewareriver.com/products/29566.htm
- http://sharewareriver.com/products/29567.htm
- http://sharewareriver.com/products/29568.htm
- http://sharewareriver.com/products/29569.htm
- http://sharewareriver.com/products/29570.htm
- http://sharewareriver.com/products/29571.htm
- http://sharewareriver.com/products/29572.htm
- http://sharewareriver.com/products/29573.htm
- http://sharewareriver.com/products/29574.htm
- http://sharewareriver.com/products/29575.htm
- http://sharewareriver.com/products/29576.htm
- http://sharewareriver.com/products/29577.htm
- http://sharewareriver.com/products/29578.htm
- http://sharewareriver.com/products/29579.htm
- http://sharewareriver.com/products/29580.htm
- http://sharewareriver.com/products/29581.htm
- http://sharewareriver.com/products/29582.htm
- http://sharewareriver.com/products/29583.htm
- http://sharewareriver.com/products/29584.htm
- http://sharewareriver.com/products/29585.htm
- http://sharewareriver.com/products/29586.htm
- http://sharewareriver.com/products/29587.htm
- http://sharewareriver.com/products/29588.htm
- http://sharewareriver.com/products/29589.htm
- http://sharewareriver.com/products/29590.htm
- http://sharewareriver.com/products/29591.htm
- http://sharewareriver.com/products/29592.htm
- http://sharewareriver.com/products/29593.htm
- http://sharewareriver.com/products/29594.htm
- http://sharewareriver.com/products/29595.htm
- http://sharewareriver.com/products/29596.htm
- http://sharewareriver.com/products/29597.htm
- http://sharewareriver.com/products/29598.htm
- http://sharewareriver.com/products/29599.htm
- http://sharewareriver.com/products/29600.htm
- http://sharewareriver.com/products/29601.htm
- http://sharewareriver.com/products/29602.htm
- http://sharewareriver.com/products/29603.htm
- http://sharewareriver.com/products/29604.htm
- http://sharewareriver.com/products/29605.htm
- http://sharewareriver.com/products/29606.htm
- http://sharewareriver.com/products/29607.htm
- http://sharewareriver.com/products/29608.htm
- http://sharewareriver.com/products/29609.htm
- http://sharewareriver.com/products/29610.htm
- http://sharewareriver.com/products/29611.htm
- http://sharewareriver.com/products/29612.htm
- http://sharewareriver.com/products/29613.htm
- http://sharewareriver.com/products/29614.htm
- http://sharewareriver.com/products/29615.htm
- http://sharewareriver.com/products/29616.htm
- http://sharewareriver.com/products/29617.htm
- http://sharewareriver.com/products/29618.htm
- http://sharewareriver.com/products/29619.htm
- http://sharewareriver.com/products/29620.htm
- http://sharewareriver.com/products/29621.htm
- http://sharewareriver.com/products/29622.htm
- http://sharewareriver.com/products/29623.htm
- http://sharewareriver.com/products/29624.htm
- http://sharewareriver.com/products/29625.htm
- http://sharewareriver.com/products/29626.htm
- http://sharewareriver.com/products/29627.htm
- http://sharewareriver.com/products/29628.htm
- http://sharewareriver.com/products/29629.htm
- http://sharewareriver.com/products/29630.htm
- http://sharewareriver.com/products/29631.htm
- http://sharewareriver.com/products/29632.htm
- http://sharewareriver.com/products/29633.htm
- http://sharewareriver.com/products/29634.htm
- http://sharewareriver.com/products/29635.htm
- http://sharewareriver.com/products/29636.htm
- http://sharewareriver.com/products/29637.htm
- http://sharewareriver.com/products/29638.htm
- http://sharewareriver.com/products/29639.htm
- http://sharewareriver.com/products/29640.htm
- http://sharewareriver.com/products/29641.htm
- http://sharewareriver.com/products/29642.htm
- http://sharewareriver.com/products/29643.htm
- http://sharewareriver.com/products/29644.htm
- http://sharewareriver.com/products/29645.htm
- http://sharewareriver.com/products/29646.htm
- http://sharewareriver.com/products/29647.htm
- http://sharewareriver.com/products/29648.htm
- http://sharewareriver.com/products/29649.htm
- http://sharewareriver.com/products/29650.htm
- http://sharewareriver.com/products/29651.htm
- http://sharewareriver.com/products/29652.htm
- http://sharewareriver.com/products/29653.htm
- http://sharewareriver.com/products/29654.htm
- http://sharewareriver.com/products/29655.htm
- http://sharewareriver.com/products/29656.htm
- http://sharewareriver.com/products/29657.htm
- http://sharewareriver.com/products/29658.htm
- http://sharewareriver.com/products/29659.htm
- http://sharewareriver.com/products/29660.htm
- http://sharewareriver.com/products/29661.htm
- http://sharewareriver.com/products/29662.htm
- http://sharewareriver.com/products/29663.htm
- http://sharewareriver.com/products/29664.htm
- http://sharewareriver.com/products/29665.htm
- http://sharewareriver.com/products/29666.htm
- http://sharewareriver.com/products/29667.htm
- http://sharewareriver.com/products/29668.htm
- http://sharewareriver.com/products/29669.htm
- http://sharewareriver.com/products/29670.htm
- http://sharewareriver.com/products/29671.htm
- http://sharewareriver.com/products/29672.htm
- http://sharewareriver.com/products/29673.htm
- http://sharewareriver.com/products/29674.htm
- http://sharewareriver.com/products/29675.htm
- http://sharewareriver.com/products/29676.htm
- http://sharewareriver.com/products/29677.htm
- http://sharewareriver.com/products/29678.htm
- http://sharewareriver.com/products/29679.htm
- http://sharewareriver.com/products/29680.htm
- http://sharewareriver.com/products/29681.htm
- http://sharewareriver.com/products/29682.htm
- http://sharewareriver.com/products/29683.htm
- http://sharewareriver.com/products/29684.htm
- http://sharewareriver.com/products/29685.htm
- http://sharewareriver.com/products/29686.htm
- http://sharewareriver.com/products/29687.htm
- http://sharewareriver.com/products/29688.htm
- http://sharewareriver.com/products/29689.htm
- http://sharewareriver.com/products/29690.htm
- http://sharewareriver.com/products/29691.htm
- http://sharewareriver.com/products/29692.htm
- http://sharewareriver.com/products/29693.htm
- http://sharewareriver.com/products/29694.htm
- http://sharewareriver.com/products/29695.htm
- http://sharewareriver.com/products/29696.htm
- http://sharewareriver.com/products/29697.htm
- http://sharewareriver.com/products/29698.htm
- http://sharewareriver.com/products/29699.htm
- http://sharewareriver.com/products/29700.htm
- http://sharewareriver.com/products/29701.htm
- http://sharewareriver.com/products/29702.htm
- http://sharewareriver.com/products/29703.htm
- http://sharewareriver.com/products/29704.htm
- http://sharewareriver.com/products/29705.htm
- http://sharewareriver.com/products/29706.htm
- http://sharewareriver.com/products/29707.htm
- http://sharewareriver.com/products/29708.htm
- http://sharewareriver.com/products/29709.htm
- http://sharewareriver.com/products/29710.htm
-