User:Alexsmail/Computer programming/How Objects should be correctly compared in Java
Introduction
editSee appendix A for formal definition.
Method along consideration
editequals()
editObject hirerachy and its state (getClass() or instanceof ?). Immutable object. Object.equals()
hashCode()
editNatural order - compareTo()
editcompareTo()
editMap (Hashtable)
editCombination consideration
editequals() and hashCode()
editequals() and compareTo()
editequals() and compareTo() and hashCode()
editHashMap, equals() and compareTo()
editTreeMap, equals() and compareTo()
editMaps, Hashtable and Set and Arrays
editHashMap's and Set's key
editImmutable. keys are Uniformly distributed.
TreeMap vs HashMap
editSort
editQuickSort MergeSort Stable sort Comparator TreeMap
Miscellaneous
editsignum function
editSorting with Comparator
edit
Appendix B
editMathematic background
editSet Order pair Relation Relation over Set Two-place relation function function in Java Partial Order Full order Equivalence relation Equivalence class