Complete the code below so that it returns the element from the list studentList at the index provided through @PathVariable.
Java
@RestController
public class StudentController {
List<Student> studentList = List.of(
new Student("John"),
new Student("Jane")
);
@GetMapping("/student/{index}")
public Student getStudent(@PathVariable int index) {
return _____________
}
}Kotlin
@RestController
class StudentController {
val studentList = listOf(
Student("John"),
Student("Jane")
)
@GetMapping("/student/{index}")
fun getStudent(@PathVariable index: Int): Student {
return _____________
}
}