TimestampComparator

A Comparator that compares Snowflakes solely by their timestamps.

The ordering imposed by this comparator is different from the natural ordering of Snowflakes in the sense that two Snowflakes with the same timestamp are always considered equal and their workerId, processId and increment are not taken into account.

Note: this comparator imposes an ordering that is inconsistent with equals, as defined by Comparator. It therefore shouldn't be used to order a SortedSet or SortedMap. This is because TimestampComparator only compares the first 42 bits of the ULong value (comparing the timestamp), whereas equals compares all the bits of the value. TimestampComparator can return 0 even if equals returns false, but equals only returns true if TimestampComparator returns 0.