You can get items from an ArrayList by index, just like an array. Can't you just loop through every index, comparing each?