The question arose while reading a answer to this question - How do I join two lists in java. This answer gave the solution
List newList = new Arra
This particular use of anonymous classes has several problems:
ArrayList
, you just want some array list with some existing values in itjoinLists(listOne, listTwo)
)In my opinion #1 is the most important reason to avoid it, closely followed by #2. #3 is usually not that much of a problem, but should not be forgotten.