CurrentFileRevisionProvider (@NotNull FileAnnotation annotation) { List<VcsFileRevision> revisions = annotation.getRevisions(); if (revisions == null) return null; Map<VcsRevisionNumber, VcsFileRevision> map = new HashMap<>(); for (VcsFileRevision revision : revisions) { map.put(revision.getRevisionNumber(), revision); } List<VcsFileRevision> lineToRevision = new ArrayList<>(annotation.getLineCount()); for (int i = 0; i < annotation.getLineCount(); i++) { lineToRevision.add(map.get(annotation.getLineRevisionNumber(i))); } return (lineNumber) -> { LOG.assertTrue(lineNumber >= 0 && lineNumber < lineToRevision.size()); return lineToRevision.get(lineNumber); }; }