- All times will be communicated in a way that is unambiguous. This communication may be a local time, with a UTC offset specified.
For example:
| // when passing parameters to method calls. You may replace parenthesis with curly braces if, and only if, | |
| // the method expects a single parameter. For example: | |
| List(1, 2, 3).reduceLeft{_ + _} // valid, single Function2[Int,Int] parameter | |
| List{1, 2, 3}.reduceLeft(_ + _) // invalid, A* vararg parameter | |
| // Why multiple parameters lists scala ? | |
| // First: you can have multiple var args: |
| import java.nio.ByteBuffer; | |
| import java.util.UUID; | |
| public class UuidAdapter { | |
| public static byte[] getBytesFromUUID(UUID uuid) { | |
| ByteBuffer bb = ByteBuffer.wrap(new byte[16]); | |
| bb.putLong(uuid.getMostSignificantBits()); | |
| bb.putLong(uuid.getLeastSignificantBits()); | |
| return bb.array(); |
| import java.util.Optional | |
| /** | |
| * Conversions between Scala Option and Java 8 Optional. | |
| */ | |
| object JavaOptionals { | |
| implicit def toRichOption[T](opt: Option[T]): RichOption[T] = new RichOption[T](opt) | |
| implicit def toRichOptional[T](optional: Optional[T]): RichOptional[T] = new RichOptional[T](optional) | |
| } |
| ; The code in this file was mechanically extracted from the TeX | |
| ; source files of _Ansi Common Lisp_, except for bst-remove and | |
| ; bst-delete and their subroutines, which replace broken versions | |
| ; in the book. | |
| ; If you have questions or comments about this code, or you want | |
| ; something I didn't include, send mail to lispcode@paulgraham.com. | |
| ; This code is copyright 1995 by Paul Graham, but anyone who wants | |
| ; to use it is free to do so. |
| /* | |
| * Referentially transparent program to print the size of files. | |
| * | |
| * Techniques inspired by: | |
| * "Dead-Simple Dependency Injection" | |
| * Rúnar Óli Bjarnason | |
| * Northeast Scala Symposium, 2012 | |
| * | |
| * To run: "scala filesizerer.scala" | |
| * When prompted, enter a file name. |