The Artima Developer Community
Sponsored Link

Java Buzz Forum
Playing with varargs

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
Playing with varargs Posted: Aug 21, 2004 12:46 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: Playing with varargs
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement
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 :) :)

Read: Playing with varargs

Topic: JUnit: A critical look Previous Topic   Next Topic Topic: What does XA stand for

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use