Kotlinlearncs.online LogoJava
Return to List

Homework: List Unique Items

Created By: Geoffrey Challen
/ Version: 2021.9.0

Create a method uniqueItems. uniqueItems accepts a list of Anys 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.

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 Any. You may use collections like Maps or Sets for this problem, but they are not required.

Related Lessons

Stuck? You may find these lessons helpful: