If you don't care about duplicates, just use Set#classify.


-- 
Lou.