Java Set

Java Set

32.996 Lượt nghe
Java Set
The Java Set interface represents a set (collection) of objects in Java which is unordered, and where each element is unique, meaning each element is only present once in a Java Set. A Java Set is a handy way to sort out duplicats from an array or List. Add all the elements to a Java Set, and each element will only exist once in the Set when you are done. This is different from a Java List or arrays where the elements can be present multiple times. Chapters 0:00 Java Set introduction 0:45 Java Set vs. Java List 1:36 Java Set implementations 2:43 Java Set generic types 3:26 Add elements to a Java Set 4:44 Create Set using Set.of() 5:07 Iterate elements of a Java Set using Iterator 6:14 Java HashSet vs. Java TreeSet 7:22 Iterate elements of a Java Set using for-each loop 8:05 Iterate elements of a Java Set using the Java Streams API 9:07 Remove element from a Java Set 10:06 Remove all elements from a Java Set 10:18 Add all elements from a Java Collection to a Java Set 11:22 Remove all elements in a Java Collection from a Java Set 12:10 Retain all elements from a Java Collection in a Java Set 12:54 Java Set size - obtain number of elements in a Java Set 13:24 Check if Java Set is empty 13:50 Check if Java Set contains specific element 14:34 Convert Java Set to a Java List Here is a textual version of this Java Set tutorial: http://tutorials.jenkov.com/java-collections/set.html Here are links to my Java List tutorials: http://tutorials.jenkov.com/java-collections/list.html https://www.youtube.com/watch?v=d3QbptJRln4 Java Streams Tutorial - text / video: http://tutorials.jenkov.com/java-functional-programming/streams.html https://www.youtube.com/watch?v=bcrl-GL0vV4