Small optimization to equals method in intervals