Java Collection How to - Java Set Example

  1. Java Add elements to a set which maintains the insertion order
  2. Java Add objects to Binary Search tree using custom comparator
  3. Java Add value to a sorted set
  4. Java Assign 52 cards randomly equally among 4 players
  5. Java Check for Existence for a single value or a subset
  6. Java Compare elements in list and remove if some properties are the same
  7. Java Count the occurences of each character in a String with Hashmap
  8. Java Create a Set based on hash value
  9. Java Create Enumeration from set
  10. Java Create final HashMap that should not allow to update or remove element
  11. Java Create iterator that does not support remove()
  12. Java Create java.util.Set implementation without using element.hashCode()
  13. Java Get Differences Between Two Integer Collection
  14. Java Get duplicates from an array by checking the frequency
  15. Java Get duplicates from an array in efficient way
  16. Java Get Iterator for a Set
  17. Java Initialize HashMap with lambda expressions
  18. Java Iterate through a list in reverse order
  19. Java Keep List index fixed while removing data
  20. Java Parallelize search in a Java set
  21. Java Remove all the elements from one Set to another
  22. Java Union, Intersect and Differ, check sub set


  1. Java Add Comparable objects to a TreeSet(Sorted Set)
  2. Java Create a TreeSet(Sorted Set) with custom Comparator
  3. Java Create TreeSet(Sorted Set) with reversed order comparator
  4. Java Get Head Set from TreeSet(Sorted Set)
  5. Java Get lowest and highest value stored in TreeSet
  6. Java Get Sub Set from TreeSet
  7. Java Get Tail Set from TreeSet
  8. Java Get the values from a TreeSet(sorted set)
  9. Java Implement generic Comparable for TreeSet for sorting
  10. Java Store string objects in treeset in descending order


  1. Java Compare two objects in custom tree set implementation
  2. Java Compare two sets


  1. Java Convert Array to a Set
  2. Java Convert a List to a Set
  3. Java Convert HashSet to Enumeration
  4. Java Convert Set into List
  5. Java Convert set to an Array
  6. Java Convert Set to Enumeration
  7. Java Convert Set to Synchronized Set
  1. Java Find maximum/Minimum element of Set
  2. Java Find out how many elements are in a set, check if a set is empty
  3. Java Find the duplicate values in two Arrays