![]() | elem |-Įach node is related to an item of the linked list. | First|->| Data | to next |->| Data | to next|. The name LinkedList implies a special data structure where the elements/nodes are connected by pointers. Non-synchronized, update operation is faster than other lists, easy to use for stacks, queues, double-ended queues. When you have a large list, and you have lots of insert and remove, consider using the LinkedList. Whenever you insert or remove an element from the list, there are extra overhead to reindex the list. When only one thread is accessing the list, use the ArrayList. Vector is slower, because of the extra overhead to make it thread safe. The ArrayList is not synchronized, not thread safe. The basic implementation of the List interface is the ArrayList. It represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with five operations that allow a vector to be treated as a stack. Synchronized, use in multiple thread access, otherwise use ArrayList. Duplicates are allowed, the same element can be added twice to a list. In a list collection, the elements are put in a certain order, and can be accessed by an index. (If fromElement and toElement are equal, the returned sorted set is empty.) Returns elements range from fromElement, inclusive, to toElement, exclusive. SortedSet subSet(E fromElement, E toElement) Returns from the inclusive fromElement to the end Returns from the first, to the exclusive toElement The SortedSet interface has additional methods due to the sorted nature of the 'Set'. This is so because the Set interface is defined in terms of the equals operation, but a sorted set performs all element comparisons using its compare method, so two elements that are deemed equal by this method are, from the standpoint of the sorted set, equal. Note that the ordering maintained by a sorted set must be consistent with equals if the sorted set is to correctly implement the Set interface. ![]() All elements in the SortedSet must implement the Comparable Interface, furthermore all elements must be mutually comparable. The SortedSet interface is the same as the Set interface plus the elements in the SortedSet are sorted.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |