Skip to content

hw4#2

Open
pertsevpv wants to merge 4 commits intomasterfrom
lesson4
Open

hw4#2
pertsevpv wants to merge 4 commits intomasterfrom
lesson4

Conversation

@pertsevpv
Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/main/kotlin/Main.kt Outdated
@@ -0,0 +1,9 @@
fun main() {
for (i in Service().f5a()) println(i)
println("\n----------///----------\n")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

придумал бы че нить тут красивое чтоб не копипастить)

Comment thread src/main/kotlin/Service.kt Outdated
class Service {

fun f5a() =
UserData().userData().map { it ->
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

переменная уже по умолчанию определена как it) тут лучше давать осмысленное название или не давать тогда его вообще)
если большая вложенность и внутри тоже есть вызов подобных функций лучше давать название чтоб самому не забудится

Comment thread src/main/kotlin/Service.kt Outdated
)
}

fun f5b() =
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

запись через равно классная, но лучше все равно писать какой тип у тебя возвращается, так читать потом в разы лучше

Comment thread src/main/kotlin/Service.kt Outdated
fun f5c() =
f5a().groupBy { it.email.substring(it.email.indexOf('@')) }

fun f5d() = f5a().filter { it.name[0] == it.surname[0] }.size
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а почему тут в 1 строчку? а до этого начинал с новой строки?)
выбери единый какой то стиль)
и кажется тут зайдет оператор count {}

Comment thread src/main/kotlin/UserData.kt Outdated
User(25, "Ivan", "Petrov", "IvanPetrov_391333@outlook.com", 391333)
)

fun userData() = userList
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше писать возвращаемый тип

Copy link
Copy Markdown

@rumBo90 rumBo90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поправь, где написал) и что сам еще найдешь

Comment thread src/main/kotlin/Main.kt Outdated
col.forEach {
println(it)
}
println("\n----------///----------\n")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я имел виду чисто строчку
println("\n----------///----------\n") - обернуть как нить красиво)

а то в итоге у тебя получилось 2 test, перегржуенных) почти с одинаковым кодом.
из-за того что map не itarable как я понимаю)

Copy link
Copy Markdown

@rumBo90 rumBo90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Глянь последний коммент

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants