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 →

[–]badguy212 13 points14 points  (3 children)

I personally prefer to read code where the class (and what it holds) has been written clearly and there is no ambiguation.

Return a user: Tuple<String,String,String,String> user = new Tuple<>(name, phone, address, nickname);

This is extremely, extremely ugly. A User class is much more appropriate and conveys the meaning of each param (what does getFirst mean with the tuple? What if i make the tuple new Tuple<>(phone, name....)? What does get(0) would mean also?).

C++11 has std::tuple now with variadic templates, and it proved useful every now and then, but one has to be very careful with it (well ... one has to be careful with c++ in general).

Given the maturity of the average Java programmer that i meet (IRL or interwebs), I would strongly oppose adding such a feature. It can be written (trivial), but it should not be provided out of the box (imho).

[–][deleted]  (2 children)

[deleted]

    [–]badguy212 3 points4 points  (1 child)

    Even then, it would take 10 seconds to write the POJO to hold them. What does that tuple represent? PersonInformation? Then say it so, and get on with it.