logo       

Singleton sets: msg#00404

lang.scala

Subject: Singleton sets

What's the canonical equivalent of java.util.Collections.singleton() in
Scala? The obvious candidate appears to be,

Set(e)

ie.

scala.collection.immutable.Set.apply(e)

but enfortunately the element type A is view-bounded by Ordered[A] so
this fails for for elements of non-Ordered types. Is this intentional?
the bound doesn't appear to be doing any useful work here.

Cheers,


Miles



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise