static int tieBreakOrder ( Object a , Object b ) { int d ; if ( a == null || b == null || ( d = a . getClass ( ) . getName ( ) . compareTo ( b . getClass ( ) . getName ( ) ) ) == 0 ) d = ( System . identityHashCode ( a ) <= System . identityHashCode ( b ) ? - 1 : 1 ) ; return d ; }
Tie - breaking utility for ordering insertions when equal hashCodes and non - comparable . We don t require a total order just a consistent insertion rule to maintain equivalence across rebalancings . Tie - breaking further than necessary simplifies testing a bit .