Creating classes that can be instantiated with single or multiple elements as constructor's argument
- by Jeriho
I want to have class that can be instantiated with list, array, seq, set, stack, queue etc.
In my opinion
class A
class B(elems:A*)
should handle such stuff.
This is my solution:
class A
class B(elems:Iterable[A]){
def this(elem:A) = this(Seq(elem))
}
Can you suggest any improvements?