Skip to content

Instantly share code, notes, and snippets.

David Greenhalgh dgreenhalgh

Block or report user

Report or block dgreenhalgh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dgreenhalgh
dgreenhalgh / SimVillage.kt
Created Oct 5, 2018
Big Nerd Ranch Anonymous Functions - SimVillage
View SimVillage.kt
fun main(args: Array<String>) {
runSimulation()
}
fun runSimulation() {
val greetingFunction = configureGreetingFunction()
println(greetingFunction("Guyal"))
}
fun configureGreetingFunction(): (String) -> String {
@dgreenhalgh
dgreenhalgh / Jhava.java
Created Oct 4, 2018
Big Nerd Ranch Java Interoperability - Jhava
View Jhava.java
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.function.Function;
public class Jhava {
@dgreenhalgh
dgreenhalgh / Hero.kt
Created Oct 4, 2018
Big Nerd Ranch Java Interoperability
View Hero.kt
@file:JvmName("Hero")
import java.io.IOException
fun main(args: Array<String>) {
val adversary = Jhava()
println(adversary.utterGreeting())
val friendshipLevel = adversary.determineFriendshipLevel()
println(friendshipLevel?.toLowerCase() ?: "It's complicated.")
You can’t perform that action at this time.