getOverlappingIntervals

This function takes 2 sets of Kotlin IntRange and returns a Set of overlapping positions. It is only called internally from findIntersectingPosition().

To guarantee accurate results in the case of a user calling this function directly with unsorted sets, the sets are sorted again here.