#1795 Use ArrayList instead of HashSet (cherry-picked from 3.x branch)
#1795 Incorporate missing constructor arg
#1795 Add comment documenting the use of ArrayList
#1795 Add test to cover the fix
Merge pull request #2099 from kennymacleod/master

#1795 Use ArrayList instead of HashSet (cherry-picked from 3.x branch)