Class DedupExamples
java.lang.Object
fr.univtln.bruno.samples.java101.tp3.functional.DedupExamples
Stream-based deduplication examples: utility class with static methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcollectToLinkedHashSet(List<String> withDup) Show collecting into a LinkedHashSet via stream then LinkedHashSet constructor.static voiddedupWithStreamDistinct(List<String> withDup) Show deduplication using stream distinct().
-
Method Details
-
dedupWithStreamDistinct
Show deduplication using stream distinct(). This is the preferred functional style when you already have a stream-based pipeline.- Parameters:
withDup- list containing duplicated elements
-
collectToLinkedHashSet
Show collecting into a LinkedHashSet via stream then LinkedHashSet constructor.- Parameters:
withDup- list containing duplicated elements
-