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
| 1.+(2) | |
| (1).+(2) |
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
| val tuple = (1, 2, "Three", 'f') |
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 scala.io.Source | |
| if (args.length > 0) { | |
| val fileLines = Source.fromFile(args(0)).getLines().toList | |
| val maxLengthLine = fileLines.reduceLeft((a, b) => { | |
| if (a.length > b.length) a else b | |
| }).length.toString().length | |
| for (line <- fileLines) { |
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 ostretsov.Client | |
| object ClientRepository { | |
| def main (args: Array[String]): Unit = { | |
| println(Client.build("Artem Ostretsov", true).id) | |
| println(Client.build("Martin Odersky", true).id) | |
| println(Client.build("Vasya Pupkin", false).id) | |
| println(Client.build("Artem Ostretsov", false).id) | |
| } |
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 ostretsov | |
| import scala.collection.mutable | |
| /** | |
| * Created by rufog on 27.12.14. | |
| */ | |
| object Client { | |
| var lastId = 0; |
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 DummyClass { | |
| def dummy(x: Integer, y: Integer): Unit = println("x: "+x+", y: "+y) | |
| } |
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 test(): Unit = "Test is Ok!" |
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 EntryPoint { | |
| def main(args: Array[String]): Unit = { | |
| for (arg <- args) { | |
| println(arg) | |
| } | |
| } | |
| } |
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
| println(1.toString) // outputs what is expected | |
| println(1.toString()) // ok | |
| println("scala is great!".capitalize) // ok | |
| println("scala is great!".capitalize()) // 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
| val a = math.pow(2, 32).toInt | |
| println(a.getClass+": "+a) |