SlideServe
Menu
Préférences
© SlideServe · v2026

Java Collections Framework

jody avatar
34 diapositives · 1.4K Views · Jul 16, 2014

Java Collections Framework. A presentation by Eric Fabricant. What is it?. “The Collections Framework provides a well-designed set of interfaces and classes for storing and manipulating groups of data as a single unit, a collection.” -java.sun.com. So what?.

Java Collections Framework - slide 1
01 / 34Java Collections Framework
1 / 17

Télécharger la présentation

Java Collections Framework
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Java Collections Framework A presentation by Eric Fabricant

  2. What is it? “The Collections Framework provides a well-designed set of interfaces and classes for storing and manipulating groups of data as a single unit, a collection.” -java.sun.com

  3. So what? Well, The framework provides a convenient API to many of the abstract data types familiar to computer science: maps, sets, lists, trees, arrays, hashtables and other collections.

  4. What does it look like?

  5. The Basics simple, but not really. • Set • List • Map

  6. What makes a Set a Set? No duplicate elements are allowed, such that e1.equals(e2) is true.

  7. More on Sets The Set Interface extends the Collection Interface. AbstractSet implements Set and extends AbstractCollection AbstractSet is a convenience class that contains basic concrete implementation.

  8. Types of Sets • HashSet • LinkedHashSet • TreeSet

  9. HashSet Implements the Set interface, backed by a hash table (actually a HashMap instance). Makes no guarantees as to the iteration order of the set. It does not guarantee that the order will remain constant over time. Permits the null element.

  10. LinkedHashSet Extends HashSet. Implements doubly-linked list. Can retrieve elements based on insertion-order. Less efficient than HashSet.

  11. TreeSet Extends AbstractSet, implements SortedSet Elements can be kept in acscending order according to compareTo() or compare() All elements must be comparable.

  12. Any questions?

  13. What makes a List a List? Duplicate elements are allowed and position-oriented operations are permitted.

  14. More on Lists The List Interface extends the Collection Interface. AbstractList implements List and extends AbstractCollection AbstractList is a convenience class that contains basic concrete implementation.

  15. Types of Lists • ArrayList • LinkedList • Vector • Stack

  16. ArrayList Extends AbstractList Auto-resizeable. Based on a simple array. Permits the null element.

  17. LinkedList Extends AbstractSequentialList, which extends AbstractList Similar to ArrayList Different implementation based on nodes that contain data and links to other nodes.

  18. Nodes In Action

  19. Vector Similar to ArrayList Contains synchronized methods.

  20. Stack Extends Vector “Last in, First Out” behavior Contains methods to allow typical Stack behaviors. (ie: push(), pop(), etc. )

  21. Any questions?

  22. What makes a Map a Map? The collection is kept in key/value pairs. Any object can be a key or value. No duplicate keys allowed.

  23. More on Maps The Map Interface does not extend the Collection Interface. AbstractMap implements Map and does not extend AbstractCollection AbstractMap is a convenience class that contains basic concrete implementation.

  24. Types of Maps • TreeMap • HashMap • LinkedHashMap

  25. TreeMap Implements SortedMap, extends AbtractMap Keys can be kept in acscending order according to compareTo() or compare()

  26. HashMap Implements SortedMap, extends AbstractMap Permits the null element. Makes no guarantees as to the iteration order of the set.

  27. More HashMap It does not guarantee that the order will remain constant over time. Can retrieve elements based on insertion-order or access order.

  28. LinkedHashMap Extends Hashmap Implements doubly-linked list.

  29. Any questions?

  30. Collections Class • Contains static methods for operating on collections and maps. • Quite usefull :-)

  31. Arrays Class • Contains static methods sorting and searching arrays, comparing arrays, and filling array elements.

  32. Additional Info • Synchronized Collection classes can be found in java.util.Collections

  33. ( the end )

  34. Credits Material Adapted from: Java Programming, 5th ed. by Y. Daniel Liang & Java.sun.com