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 Test { | |
| def update[T](t: T) { | |
| println(t) | |
| } | |
| } | |
| scala> Test() = 1 | |
| 1 |
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 zoo; | |
| class Animal {} | |
| class Lion extends Animal {} | |
| class Cage<T extends Animal> { | |
| void add(T animal) { System.out.println("Adding animal..."); } | |
| public static void main(String... args) { |
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 zoo | |
| class Animal | |
| class Lion extends Animal | |
| class Cage[+T <: Animal] { | |
| def add(animal: T) { println("Adding animal...") } // ERROR | |
| } |
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
| trait Coffee { | |
| def id: Long | |
| def name: String | |
| def brand: String | |
| } | |
| Query.from[Coffee] | |
| .select(_.id) | |
| .where(_.brand == "FairTrade") |
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
| scala> implicit case class Foo(foo: Int) extends AnyVal | |
| defined class Foo | |
| scala> Foo(1) | |
| <console>:10: error: ambiguous reference to overloaded definition, | |
| both method Foo of type (foo: Int)Foo | |
| and object Foo of type Foo.type | |
| match argument types (Int) | |
| Foo(1) | |
| ^ |
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
| scala> import java.nio.file.Paths | |
| import java.nio.file.Paths | |
| scala> val inputPaths = Paths.get(".") | |
| inputPaths: java.nio.file.Path = . | |
| scala> val inputPaths = Paths.get("test") | |
| <console>:8: error: type mismatch; | |
| found : String("test") | |
| required: java.net.URI |
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
| java.io.IOException: log:null | |
| R/W/S=1956/0/0 in:NA [rec/s] out:NA [rec/s] | |
| minRecWrittenToEnableSkip_=9223372036854775807 LOGNAME=null | |
| HOST=null | |
| USER=mapred | |
| HADOOP_USER=null | |
| last Hadoop input: |null| | |
| last tool output: |null| | |
| Date: Sun Sep 02 06:08:56 CEST 2012 | |
| java.io.IOException: Broken pipe |
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
| //// scala/time/package.scala | |
| package scala | |
| package object time { | |
| type Duration = javax.time.Duration | |
| implicit def DurationToRichDuration(duration: Duration) = new RichDuration(duration) | |
| type Instant = javax.time.Instant | |
| implicit def InstantToRichInstant(instant: Instant) = new RichInstant(instant) |
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
| /** Doc */ | |
| // Comment | |
| def foo ... |
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 throws[T <: Throwable](cause: String) extends scala.annotation.StaticAnnotation { | |
| def this(clazz: Class[T]) = this("") | |
| } |