Improve speed 15% by replacing HashSet with ArrayList to avoid unnecessary uniqueness checking since it is guaranteed.