Created
February 15, 2019 22:08
-
-
Save jnizet/7f7ca3cac338ae15c0b7ce721b25f230 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Course(val id: Long, val students: MutableSet<Student> = mutableSetOf()) | |
data class Student(val id: Long, val courses: MutableSet<Course> = mutableSetOf()) | |
fun main() { | |
val english = Course(1L) | |
val john = Student(1L) | |
english.students.add(john) | |
john.courses.add(english) | |
println(john) // StackOverflowError | |
println(english.students.contains(john)) // StackOverflowError | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment