I would create it once instead of in each call. HashSet.contains feels faster from an array for 5 elements.