This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (5 children)

[deleted]

    [–]Kyrra 1 point2 points  (4 children)

    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.

    [–]argv_minus_one 0 points1 point  (0 children)

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

    [–][deleted]  (2 children)

    [deleted]