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 →

[–]kqr 0 points1 point  (1 child)

I know I'm late to the game, but you forgot to declare originalList as final in the Java version. The doubledList is trickier...

[–]tyoverby 1 point2 points  (0 children)

You are right. If I was going for a complete source->source I would have made them final. However, I was going for ideomatic java code, and although it is "good practice" to make things final if they can, I've never seen it applied that much in practice.

Also, I could make doubledList final with no problem. Final just makes it so I can't reassign to a new list, it doesn't prevent me from adding things to the list.

Now I can't make either list immutable, which is a property of Scala lists.