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
| try (Reader reader = new FileReader("input.txt")) { | |
| // Use the input | |
| } catch (FileNotFoundException e) { | |
| // Handle possible exception | |
| } catch (IOException e2) { | |
| // Handle another exception | |
| } |
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
| Reader reader = null; | |
| try { | |
| reader = new FileReader("input.txt"); | |
| // Use the input | |
| } catch (FileNotFoundException e) { | |
| // Handle possible exception | |
| } catch (IOException e2) { | |
| // Handle another exception | |
| } finally { | |
| if (reader != null) { |
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 svg = svg { | |
| width = 200 | |
| height = 200 | |
| rect { | |
| title { | |
| body = "A Blue Rectangle" | |
| } | |
| x = 50 | |
| y = 50 | |
| width = 20 |
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 org.springframework.stereotype.Controller | |
| import org.springframework.ui.Model | |
| import org.springframework.web.bind.annotation.GetMapping | |
| import org.springframework.web.bind.annotation.RequestParam | |
| @Controller | |
| class StatusMapController { | |
| @GetMapping("/status") | |
| fun statusMap(model: Model, @RequestParam(defaultValue = "prod") env: String): String { |
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 org.springframework.boot.SpringApplication | |
| import org.springframework.boot.autoconfigure.SpringBootApplication | |
| @SpringBootApplication | |
| class Application | |
| fun main(args: Array<String>) { | |
| SpringApplication.run(Application::class.java, *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
| assertj_version=3.10.0 | |
| junit_platform_version=1.2.0 | |
| jupiter_version=5.2.0 | |
| jvm_version=1.8 | |
| kotlin_version=1.2.50 | |
| serialization_version=0.5.1 | |
| spring_boot_version=2.0.3.RELEASE |
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
| buildscript { | |
| ext { | |
| springBootVersion = spring_boot_version | |
| kotlin_version = kotlin_version | |
| } | |
| repositories { | |
| jcenter() | |
| maven { url "https://kotlin.bintray.com/kotlinx" } | |
| } | |
| dependencies { |
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
| inline fun NodeList.forEach(block: Node.() -> Unit) { | |
| for (i in 0 .. (length - 1)) { | |
| item(i).block() | |
| } | |
| } |
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
| fun NodeList.forEach(block: Node.() -> Unit) { | |
| for (i in 0 .. (length - 1)) { | |
| item(i).block() | |
| } | |
| } | |
| // And used it like... | |
| nodelist.forEach { | |
| if (it.nodeType == Node.ELEMENT_NODE) { | |
| return it | |
| } |
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
| for (i in 0 .. (nodelist.length - 1)) { | |
| if (nodelist.item(i).nodeType == Node.ELEMENT_NODE) { | |
| return nodelist.item(i) | |
| } | |
| } |