Java 8 release 25 changed generics inference in a way that breaks uses
of Collectors.toSet() and toList(). Refactored to avoid.

Also pulled direct calls to toSet() into util methods to
allow for use of linked sets.