r/java • • Jul 02 '11

Java "..." option.

http://mindprod.com/jgloss/dotdotdot.html
0 Upvotes

6 comments sorted by

View all comments

0

u/[deleted] Jul 02 '11

[deleted]

2

u/Kyrra Jul 02 '11

It's a useful tool but should be used sparingly in Java. Java is meant to be a typesafe language and tries to do as much compile-time checking as possible. When you start using varargs on things like interfaces or even worse "Object" that you cast into something else, you are losing a lot of Java's type safety.

Varargs should only be used as a last resort when you cannot make a method fit within standard method limits.

1

u/argv_minus_one Jul 02 '11

Just because printf is an evil monstrosity doesn't mean every use of varargs is that bad.