List Unique Items
Create a class Unique
that provides a single class method uniqueItems
.
uniqueItems
accepts a list of Object
s and returns a count of how many of the objects in the list are unique,
meaning that there are no other objects in the list that are equal to them.
No items in the list will be null
.
For example, given the list {1, 2, 4}
you would return 3, whereas given the list {2, 2, 5}
you would return 1.
The list may contain any kind of Object
.
You may import
collections like Map
s or Set
s for this problem, but they are not required.