A collection might contain duplicate entries. What if we wanted to display the collection as distinct elements? In other words, we wish to filter the collection so that only distinct elements are displayed. This goal can be accomplished by applying the distinct method to the stream produced from the collection. To learn how to filter distinct elements from a collection, follow these four steps.