In Java we have the Class::new
syntax for constructor references. I know, there are callable references for methods, but how about constructors? A typical use case for me would be factories.
Are there constructor references in Kotlin?
21k views Asked by Kirill Rakhman At
1
You can get a function instance for a constructor by simply using
::ClassName
, as if it were a factory function.