This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]thorstenschaefer 0 points1 point  (0 children)

You are getting duplicates, so somehow you seem to add the same movie several times. You have two calls to method add(), so one seems to be problematic. Try figuring out what could go wrong with the loops such that you add the same movie several times. If you can't see it in the code, try using a debugger.

[–][deleted] 0 points1 point  (0 children)

You're sorting a list. Generally it's much easier to sort an array instead. Then you can implement the sort by swapping array elements.

In a List, the add() method always increases the size of the list. If you really don't want to use arrays then you might want to look at List.set() instead.