final Token right = range.right;
Comparator<DecoratedKey> comparator = new Comparator<DecoratedKey>()
{
public int compare(DecoratedKey o1, DecoratedKey o2)
{
if ((right.compareTo(o1.token) < 0 && right.compareTo(o2.token) < 0)
|| (right.compareTo(o1.token) > 0 && right.compareTo(o2.token) > 0))
{
// both tokens are on the same side of the wrap point
return o1.compareTo(o2);
}