Advertisement
Guest User

Untitled

a guest
May 24th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. Set
  2. - cannot contain duplicates
  3.  
  4. TreeSet
  5. - does not preserve the insertion order of elements but elements are sorted by keys
  6. - does not allow insertion of Heterogeneous objects (throw ClassCastException at Runtime)
  7. - excellent choice for storing large amounts of sorted information which are supposed to be accessed quickly because of its faster access and retrieval time
  8. - operations like printing n elements in sorted order takes O(n) time
  9. - insertion of null into a TreeSet throws NullPointerException
  10.  
  11. HashSet
  12. - permits the null element
  13. - does not guarantee the constant order of elements over time (objects are inserted based on their hash code)
  14. - very important not to set the initial capacity too high (or the load factor too low) if iteration performance is important
  15. - a hash table stores information by using a mechanism called hashing (the informational content of a key is used to determine a unique value, called its hash code)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement