*HashSet: merge getIndex calculation
handle EOF