Revision: 44294
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 9, 2011 07:25 by abelperez
Initial Code
object ListUtil { def dedupe(elements:List[String]):List[String] = { if (elements.isEmpty) elements else elements.head :: dedupe(for (x <- elements.tail if x != elements.head) yield x) } } // example usage: ListUtil.dedupe(List("one", "two", "one")).foreach(println)
Initial URL
http://abel-perez.com
Initial Description
Recursively remove duplicate elements from a List
Initial Title
Scala - Remove duplicates from List
Initial Tags
Initial Language
Scala