Created
August 15, 2020 13:53
-
-
Save ericntd/964469b5b816db3ad726195ad703e153 to your computer and use it in GitHub Desktop.
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
// prepare variable employees which is a list of Employee object | |
val csvStr = """ | |
Name,Department,Salary,Title | |
Victoria,Engineering,88429,Other | |
Ana,Other,58611,Manager | |
Amelia,UX,55086,Analyst | |
Victoria,Marketing,72769,Analyst | |
Rosa,UX,83077,Other | |
Troy,Engineering,87487,Analyst | |
Fern,Finance,76190,Engineer | |
Khadija,UX,52551,Manager | |
Troy,Engineering,76322,Other | |
Rosa,Marketing,60928,Engineer | |
Ana,Marketing,53189,Manager | |
Syeda,UX,57645,Engineer | |
""" | |
val employees = readFromCSVStr(csvStr) | |
// Actual logic here | |
employees.sumBy { it.salary }.let { | |
println("total salary: $it") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment