Please enable JavaScript.
Coggle requires JavaScript to display documents.
CS310 L08 - Coggle Diagram
CS310 L08
implements Comparable
define compareTo()
implement logic
When to return
-1
0
1
What if you don't have a class that implements Comparable?
What do?
Create comparator
(Makes a class)
or?
do something like
Comparator c1 =
new....
(then define it within...)
Map &
Sets
Map
Key and Value
Set
A bunch of elements
All unique
Not a LIST
has no order
something about hashFunction/arrays? using modulo?
collision
from modulo overlapping
hashFunction/
hashCode
can not use hashCode as index
no guarantee it's small enough
hashIndex
=compressed
hashFunction properties
a good hash code for equal field(different address) make sure the hashcode returns the same thing
must override hashing and equals
hash contract
if 2 objects are equal,
if override equals must override hash functions......
equals()
hashCode()
1 more item...