Created
October 10, 2017 13:28
-
-
Save fbcbl/d7ba2b02850bf639ab17b1043a621940 to your computer and use it in GitHub Desktop.
kotlin_testing_pt3_example
This file contains hidden or 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
| 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