Set Posted on July 10, 2013 by admin | Leave a reply Set Set prevents duplication.The common use of set is to check for duplication Since its is helpful for lookups for duplicate value HashSet provides an optimized implementation If you want the result to be sorted use TreeSet instead of HashSet