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
def processData(data: List[Data]): Try[Int] = { | |
data flatMap(x => x.sumBy(i => i.value)) | |
} |
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
def processData(data: Try[List[Data]]): Try[Int] = data match { | |
case Success(x) => x.sumBy(i => i.value) | |
case Failure(e) => Failure(e) | |
} |
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
def collectData(): Try[List[Data]] = { | |
val data = dataGetter() | |
if(data.length < 1) | |
throw new DataException("Data Collection Fails") | |
else | |
data | |
} |
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
abstract class Try[T] | |
case class Success[T](elem: T) extends Try[T] | |
case class Failure(t: Throwable) extends Try[Nothing] |
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
def collectData(): List[Data] = { | |
val data = runDataCollectionJob() | |
if(data.length == 0) | |
throw new DataException("Data Collection Fails") | |
data | |
} |
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() |
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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/> | |
<PropertyGroup> | |
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration> | |
<BuildPlatform Condition=" '$(BuildPlatform)' == '' ">AnyCPU</BuildPlatform> | |
<Solution>AdminPortal</Solution> | |
<WebsiteProjectName>$(Solution)</WebsiteProjectName> | |
<DBSetupProjectName>$(Solution)Deployment</DBSetupProjectName> | |
<BuildArtifactsDir>BuildArtifacts</BuildArtifactsDir> |
NewerOlder