Creating a sortedSet function


#1

For purposes of creating a sortedSet() function, I'm interested in why

this works

``

  inline fun sortedSet<T>(vararg values: T) : TreeSet<T> = values.to(TreeSet<T>(HashSet<T>((values.size))))

but this does not work

``

  inline fun sortedSet<T>(vararg values: T) : TreeSet<T> = values.to(TreeSet<T>(values.size))


The latter IDE view is captured in the attached screenshot.


treeset.png (135 KB)

#2

TreeSet has no constructor that takes a single integer...


#3

Ugh.  You're right.  I see it.  One day I will see when I look.