private static boolean containsOverlaps ( List < CodeReplacement > replacements ) { checkState ( ORDER_CODE_REPLACEMENTS . isOrdered ( replacements ) ) ; int start = - 1 ; for ( CodeReplacement replacement : replacements ) { if ( replacement . getStartPosition ( ) < start ) { return true ; } start = Math . max ( start , replacement . getEndPosition ( ) ) ; } return false ; }
Checks whether the CodeReplacements have any overlap . The replacements must be provided in order sorted by start position as sorted by ORDER_CODE_REPLACEMENTS .