collections java e google collections
Click here to load reader
Post on 11-Nov-2014
Embed Size (px)
DESCRIPTIONIntrodução as Collections do JDK e Google Collections
- 1. Java and Google Collections Andr Faria Gomes
- 2. What is a Collection?
- 3. It is a container ?
- 4. is simply an object that groups multiple elements into a single unit
- 5. Why?
- 6. store, retrieve, manipulate, and communicate aggregate data
- 7. The Java Collections Framework
- 8. Generics
- 9. The Collection Interface
- 10. The Iterator Interface
- 11. Lists (Positional access, Search, Iteration, Range-view)
- 12. The List Interface
- 13. The List Iterator
- 14. ArrayList Resizable-array implementation of the List interface.
- 15. Linked List (Doubly-linked) better performance if elements are frequently inserted or deleted within the list.
- 16. Vector Synchronized resizable-array with legacy methods.
- 17. Push Pop Peek The ArrayDeque is a better option Stack (LIFO)
- 18. Queue
- 19. Queue Offer(element) Method Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions. When using a capacity-restricted queue, this method is generally preferable to add(E), which can fail to insert an element only by throwing an exception.
- 20. Queue add() Method Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available.
- 21. Queue Pool Method Retrieves and removes the head of this queue, or returns null if this queue is empty.
- 22. Queue Peek Method Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.
- 23. Queue element() Method Retrieves, but does not remove, the head of this queue. This method differs from peek only in that it throws an exception if this queue is empty.
- 24. The Queue Interface ArrayDeque, LinkedBlockingDeque, LinkedList
- 25. Linked List (FIFO) Insertion Order (QUEUE - LIST - DEQUE)
- 26. PriorityQueue A Queue Ordered By Natural or Non Natural Order
- 27. The Deque Interface (Java 6) element insertion and removal at both ends
- 28. Deque Interface Methods
- 29. Deque Descending Iterator
- 30. Resizable-array implementation of the Deque interface. Array deques have no capacity restrictions; they grow as necessary to support usage. They are not thread-safe; in the absence of external synchronization, they do not support concurrent access by multiple threads. Null elements are prohibited. This class is likely to be faster than Stack when used as a stack, and faster than LinkedList when used as a queue. The ArrayDeque Implementation
- 31. BlockingQueue / BlockingDeque additionally supports operations that wait for the queue to become non-empty when retrieving an element, and wait for space to become available in the queue when storing an element
- 32. Sets
- 33. The Set Interface
- 34. HashSet (Fast, No Order)
- 35. TreeSet (Ordered by Value)
- 36. LinkedHashSet (Insertion Order)
- 37. Maps
- 38. The Map Interface
- 39. HashMap, TreeMap, LinkedHashMap
- 40. Hashtable (Synchronized HashMap)
- 41. Concurrent Map A java.util.Map providing additional atomic putIfAbsent(k,v), remove(k,v), and replace (k, oldV,newV) methods.
- 42. WeakHashMap An implementation of the Map interface that stores only weak references to its keys. Storing only weak references allows key-value pairs to be garbage-collected when the key is no longer referenced outside of the WeakHashMap.
- 43. Ordering
- 44. The Comparable Interface (Natural Order)
- 45. The Comparable Interface (Non Natural Order)
- 46. The Sorted Set and Sorted Map Interfaces maintains its elements in ascending order, sorted according to the elements' natural ordering or according to a Comparator provided at SortedSet creation time. (TreeSet and TreeMap)
- 47. The SortedSet Interface
- 48. The SortedMap Interface
- 49. The NavigableSet Interface
- 50. A SortedSet extended with navigation methods. Methods lower, floor, ceiling, and higher return elements respectively less than, less than or equal, greater than or equal, and greater than a given element, returning null if there is no such element. Ascending or descending order. This interface additionally defines methods pollFirst and pollLast that return and remove the lowest and highest element, if one exists, else returning null. Methods subSet, headSet, and tailSet. Implemented By TreeMap The NavigableSet Interface
- 51. The NavigableMap Inteface Implemented by TreeMao
- 52. Enums
- 53. EnumSet
- 54. EnumMap
- 55. Wrapper Implementations
- 56. Unmodifiable
- 57. Synchronized