Zachary Griggs wrote:Lots of good solutions here!
Personally I made the method static because if I had to use this in my project, I would create some sort of StringHelper or StringUtility class that does not get instantiated. The method itself doesn't need any sort of state to operate correctly. Though this is very much open for debate; I don't think there's a "correct" answer here so I'd be interested in hearing other perspectives.
I believe you could also do a toSet() call, rather than the .distinct().toList(). Though that works completely fine as well.