[LC0690] [API definition] The `Employee` class, and the method signature in Kotlin

LC0690

Original Post

@admin, please consider defining the Employee class as this:

data class Employee(val id: Int, val importance: Int, val subordinates: List<Int> = listOf())

Reasons are:

  1. no field must be mutable
  2. data keyword helps with destructuring later on, than bare/regular classes.

Also for the method signature, I think List<Employee> should be enough, no need in List<Employee?>, which is unnecessarily open in my opinion.

Thanks.

Comments (0)