Title: Data Structure Summary
Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER

Summary of Data Structure Interfaces

Property | Collection | List | Set | SortedSet | Map | SortedMap
Duplicates Allowed | Yes | Yes | No | No | Keys No Values Yes | Keys No Values Yes
Indexing | No | Yes by index | No | No | by Key | by Key
Sorted | No | No | No | Yes | No | Yes
Implementing Class | Anything in List or Set | ArrayList Vector LinkedList | HashSet LinkedHashSet | TreeSet | HashMap LinkedHashMap | TreeMap
Comments | Base Interface for List and Set | ArrayList very useful. Easy to create Stacks. LinkedList provides a good complementary data structure that can be useful in Queuing problems. |  |  | Used when lookup speeds are critical. | When you need a fast lookup and a sorted list

Often real world problems will consist of a combination of the above datastructures in order to exploit the good characteristics of each data structure.

Object Requirements:

equals method - required for almost anything stored in a data structure

Comparable interface - required for any datastructure related to trees (TreeSet, TreeMap). If you are going to use some of the Collections routines like sort, binarySearch, etc.

hashCode - required for hash related datastructures like HashSet, or for the keys in HashMap

Last Updated: November 11, 2013 1:59 AM