-
Sets
-
basics
- set
- \ search quickly
- eliminate duplicate
-
Set Concepts
- does not accept duplicate
- search incredibly quickly
- using hash table-- a special internal array
- places elements into specific positions called hash code
- elements are in an unpredictable order
- Set<String> words = new HashSet<String>();
- LinkedHashSet
-
TreeSet versus HashSet
- has internal linked data structure: binary search tree
- efficient for adding, removing and searching
- ordered
- a bit slower than a HashSet
-
Set Operations
- Subtopic 1
-
List
-
Collections
-
data structures
- entities store and manage data
-
collection
- an object that stores a group of other objs, called its elements
-
examples
-
list
- ordered, accessed by int indexes
-
stack
- LIFO
-
queue
- FIFO
-
set
- no duplicates
-
map
- key/value pairs
-
Java Collections Framework
- import java.util.*;
-
LinkedList versus ArrayList
-
Linked List
- easy to add elements in front or in the middle
- LinkedList<Type> <name> = new LinkedList<String>();
-
Iterators
-
iterator
- efficient retrieval of the elements in a list
- retains the current position
-
ListIterator
- works on list
- easy to remove
-
Abstract Data Types(ADTs)
- ADT
-
interface
-
List
- java.util
- declare variables and parameters using inter