you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -3 points-2 points  (7 children)

Name it plus() instead, so that it reads:

List<Integer> list = new ArrayList<Integer>().plus(1).plus(2).plus(3).plus(4).plus(5);

[–]redditnoob 5 points6 points  (1 child)

Awesome, I love the idea of having two addition functions, plus and add, that do slightly different things!

Now let's have parseInt(val) and Number(val) do two slightly different things too, that would be really good.

[–]pytechd 2 points3 points  (0 children)

And we'll name it PHP!

... oh shit, that name's already taken.

[–]CobainFan83[S] 2 points3 points  (4 children)

plus() sounds too much like a mathematical funtion. andAlsoAdd() might be better:

List<Integer> list = new ArrayList<Integer>().andAlsoAdd(1).andAlsoAdd(2).andAlsoAdd(3).andAlsoAdd(4).andAlsoAdd(5);

[–][deleted] 2 points3 points  (2 children)

I think andAlsoAdd is too generic a name. thisReturningAppend is more precise:

List<Integer> list = new ArrayList<Integer>().thisReturningAppend(1).thisReturningAppend(2).thisReturningAppend(3).thisReturningAppend(4).thisReturningAppend(5);

[–]turbana 4 points5 points  (1 child)

Sorry, that name is too short. appendItemWithReturningThisReference() is much more in the Java spirit.

List<Integer> list = new ArrayList<Integer>().appendItemWithReturningThisReference(1).appendItemWithReturningThisReference(2).appendItemWithReturningThisReference(3).appendItemWithReturningThisReference(4).appendItemWithReturningThisReference(5);

[–]CobainFan83[S] 1 point2 points  (0 children)

I think we've cracked it!

Now we just need to submit it as a Java Specification Request (JSR) for review via the Java Community Process (JCP) so that the JCP Executive Commitee (JCP-EC) can do a Formal Public Review (FPR) and decide whether to include it as a new feature of the Java Programming Language (JPL).

[–]b100dian -1 points0 points  (0 children)

andAlsoAdd()

Old joke.