OccurrenceList: a complete implementation with test.
OccurrenceList: implemented `indexOfClosest`.