Skip to content

Instantly share code, notes, and snippets.

@fbcbl
Created October 10, 2017 13:28
Show Gist options
  • Save fbcbl/d7ba2b02850bf639ab17b1043a621940 to your computer and use it in GitHub Desktop.
Save fbcbl/d7ba2b02850bf639ab17b1043a621940 to your computer and use it in GitHub Desktop.
kotlin_testing_pt3_example
class User(
private val firstName: String,
private val lastName: String,
private val age: Int) {
val fullName = "$firstName $lastName"
val canDrink = (age >= 18)
val friends: MutableList<User> = mutableListOf()
fun addFriend(user: User) {
friends.add(user)
}
fun drunkFriends() = friends.filter(User::canDrink)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment