Result (@NotNull List<? extends ResultItem> resultItems) { if (resultItems.size() == 1) { ResultItem resultItem = resultItems.get(0); return new Result(resultItem.getHighlightStartOffset(), resultItem.getHighlightEndOffset(), resultItem.getHyperlinkInfo(), resultItem.getHighlightAttributes(), resultItem.getFollowedHyperlinkAttributes()) { @Override public int getHighlighterLayer() { return resultItem.getHighlighterLayer(); } }; } return new Result(resultItems); }