Performance - The TreeSet takes log(n) times for basic operations of add, remove, size and contains.Ordering - The elements in a TreeSet are ordered using the insertion order of elements.LinkedHashSet is an implementation of the Set interface backed by a HashMap and a LinkedList, and maintains a doubly-linked list running through all of its entries.Performance - The TreeSet takes log(n) times for basic operations of add(), remove(), size() and contains().If a comparator is provided then the ordering is done as per the comparator. Ordering -The elements in a TreeSet are ordered using the natural ordering of elements.Construction - TreeSet is an implementation of the Set interface backed by a TreeMap. if the set is modified after the iterator is created, then the Iterator throws a ConcurrentModificationException. Iteration - Iterators returned by HashSet are fail-fast, i.e.Synchronization - HashSet is not synchronized.Iteration requires time proportional to sum of the HashSet size and capacity of the backing HashMap. Performance - Constant time for basic operations of add(), remove(), contains() and size().null elements - A null element is permitted in a HashSet.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |