yuriy.yarosh
07/03/2016, 5:05 PMdata class Field private constructor(val a, val b, val c) {}
fun parseFieldFrom(str: String): Field {}
instead of placing ‘em inside a companion object
data class Field private constructor(val a, val b, val c) {
companion object parser {
fun parse(field: String): Field {}
}
}
It just keeps namespaces much more cleaner.
And for me it’s much more intuitive to call a Field.parse()
instead of a parseFieldFrom()
.