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
| package com.example; | |
| public interface Result<T, E> { | |
| public class Ok<T, E> implements Result { | |
| private T t; | |
| private Ok(T t) { | |
| this.t = t; | |
| } | |
| @Override |
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 MemberType { | |
| readonly typeClassName: string; | |
| private constructor( | |
| readonly key: string, | |
| ) { | |
| this.typeClassName = this.constructor.name; | |
| } | |
| static readonly ADMIN = new MemberType("admin") | |
| static readonly USER = new MemberType("user") | |
| static getCodes(): MemberType[] { |
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
| enum BarType { | |
| TYPE_A, | |
| TYPE_B, | |
| TYPE_C | |
| } | |
| type FooFlags = { | |
| [key in ApplyType]?: boolean; | |
| }; |
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
| package com.example.openadr; | |
| import java.io.InputStream; | |
| import java.io.StringWriter; | |
| import java.util.Locale; | |
| import javax.xml.bind.JAXBContext; | |
| import javax.xml.bind.Marshaller; | |
| import javax.xml.bind.Unmarshaller; |
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
| // *** S-99: Ninety-Nine Scala Problems *** | |
| // http://aperiodic.net/phil/scala/s-99/ | |
| // | |
| // wget http://www.scala-tools.org/repo-releases/org/scalatest/scal.test_2.9.0-1/1.6.1/scalatest_2.9.0-1-1.6.1.jar | |
| // scala -cp scalatest-*.jar s99-21-28.scala | |
| import org.scalatest.matchers.ShouldMatchers._ | |
| class NotImplementedYet extends RuntimeException |
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
| // *** S-99: Ninety-Nine Scala Problems *** | |
| // http://aperiodic.net/phil/scala/s-99/ | |
| // | |
| // wget http://www.scala-tools.org/repo-releases/org/scalatest/scalatest_2.9.0-1/1.6.1/scalatest_2.9.0-1-1.6.1.jar | |
| // scala -cp scalatest-*.jar s99.scala | |
| import org.scalatest.matchers.ShouldMatchers._ | |
| // P01: Find the last element of a list. | |
| def last[T](list: List[T]): T = { |
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
| // *** S-99: Ninety-Nine Scala Problems *** | |
| // http://aperiodic.net/phil/scala/s-99/ | |
| // | |
| // wget http://www.scala-tools.org/repo-releases/org/scalatest/scalatest_2.9.0-1/1.6.1/scalatest_2.9.0-1-1.6.1.jar | |
| // scala -cp scalatest-*.jar s99-11-20.scala | |
| import org.scalatest.matchers.ShouldMatchers._ | |
| class NotImplementedYet extends RuntimeException |
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
| import actors.Actor | |
| class Get | |
| case class IsUsed(station: Station) | |
| case class MarkAsUsed(station: Station) | |
| case class MarkAsUsedResponse(isMarkedAsUsed: Boolean) | |
| case class Station(name: String) | |
| class Yamanotesen extends Actor { | |
| start() |