void (final List<LinkMatch> result, final TextRange range, final String replacement) { for (Iterator<LinkMatch> iterator = result.iterator(); iterator.hasNext(); ) { LinkMatch oldMatch = iterator.next(); if (oldMatch.getRange().intersectsStrict(range)) { if (oldMatch.getRange().getStartOffset() <= range.getStartOffset() && !oldMatch.getRange().equals(range)) { return; } iterator.remove(); } } result.add(new LinkMatch(range, replacement)); }