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 java.awt.image.BufferedImage | |
| import javax.imageio.ImageIO | |
| import java.awt.Color | |
| import java.io.File | |
| import java.awt.Rectangle | |
| import java.awt.font.LineBreakMeasurer | |
| import java.awt.Graphics2D | |
| import java.text.AttributedString | |
| import io.Source |
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 com.hp.hpl.jena.{ n3, graph } | |
| import n3.turtle.TurtleEventHandler | |
| import n3.turtle.parser.TurtleParser | |
| import graph.Triple | |
| import java.io.Reader | |
| /** | |
| * Wrapper to convert a TurtleParser into a Traversable | |
| */ |
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 canReturnNull() = "hello world" | |
| println(Option(canReturnNull) getOrElse "I'm saying nothing") | |
| //Prints: hello world | |
| def canReturnNull() = null | |
| println(Option(canReturnNull) getOrElse "I'm saying nothing") | |
| //Prints: I'm saying 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
| String value = canReturnNull(); | |
| if(value != null) | |
| println(value); | |
| else | |
| println("I'm saying 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
| Integer i = canReturnNull(); | |
| LinkedList<Integer> l = new LinkedList<Integer>(Arrays.asList(2,3,4)); | |
| if(i != null){ | |
| l.addFirst(i); | |
| } |
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 canReturnNone = Some(1) | |
| println(canReturnNone ++: List(2,3,4)) | |
| //prints: List(1, 2, 3, 4) | |
| def canReturnNone = None | |
| println(canReturnNone ++: List(2,3,4)) | |
| //prints: List(2, 3, 4) |
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
| char[] chars = {72, 101, 108, 108, 111}; | |
| String s = new String(chars); |
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(List(72, 101, 108, 108, 111).map(_.toChar)) | |
| //prints: List(H, e, l, l, o) |
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(List(72, 101, 108, 108, 111).map(_.toChar)(collection.breakOut)) | |
| //prints: hello |
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:Array[Char] = List(72, 101, 108, 108, 111).map(_.toChar)(collection.breakOut) | |
| println(a) | |
| //prints: [C@957cec |
OlderNewer