Fixed comparator to satisfy the contract. In some edge cases this could
cause issues with Java7+ (TimSort).
Merge pull request #518 from AndreasKl/master

Fixed comparator to satisfy the contract. In some edge cases this could cause issues with Java7+ (TimSort).