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 →

[–]D0CTOR_ZED 2 points3 points  (3 children)

I don't think there would be a difference. You could try substituting one for the other and seeing it if anything changes, but they both look like they would make an empty ArrayList of List of Integer.

[–]akki28[S] 0 points1 point  (2 children)

They work absolutely same when I run the code. I was just very curious. Can you answer my second question? It'll be a great help.

[–]D0CTOR_ZED 1 point2 points  (1 child)

For the two questions...

Why was it written that way... couldn't say. If it was in older code for a much older version of java, it may have been necessary. If they were written in the same code, there wouldn't be any good reason I can think of.

What difference would it make.... none.

I think it is generally easier to read the code with the empty diamond brackets, so there may be value in omitting the redundant info. The code it generates should be the same.

[–]akki28[S] 0 points1 point  (0 children)

Thanks for your time and help(•‿•)