Last active
August 29, 2015 14:22
-
-
Save ryandavidhartman/73925f14fbf5a46af397 to your computer and use it in GitHub Desktop.
Example 1 of Scala Try syntax
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
object Program { | |
def apply(): Program = new Program() | |
} | |
trait Program { | |
def collectData(): List[Data] = { some code, returning a list of Data items } | |
def processData(data: List[Data]): Int = { data.sumBy(i => i.value } | |
def Run(): Int = { | |
val program = Program() | |
val data = program.collectData() | |
program.processResults(data) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment