The problem with deduplicating the data can be changed into another problem: ensuring we won't add the data if it would be duplicated.
So instead of trying to deduplicate the array from author's example, I'd change the 'add()' method so that it searches through the whole set and doesn't add the data if it's already added.
So now it doesn't require deduplication code at all.