What does HashSet do in Java? HashSet is a data type in Java that is used to create a mathematical set. HashSet is part of the Java Collections framework and allows you to store data using the hash table data type.