Skip to content

Instantly share code, notes, and snippets.

View s1monw1's full-sized avatar
☁️
Hello, cloud.

Simon Wirtz s1monw1

☁️
Hello, cloud.
View GitHub Profile
fun trueOrFalse() = Random().nextBoolean()
public class Overloader {
public static void main(String[] args) {
Overloader o = new Overloader();
o.testWithoutPrint(2);
o.test(2);
}
public void test(int a, boolean printToConsole) {
if (printToConsole) System.out.println("int a: " + a);
}
fun test(a: Int, printToConsole: Boolean = true) {
if (printToConsole) println("int a: " + a)
}
fun testWithoutPrint(a: Int) = test(a, false)
fun main(args: Array) {
testWithoutPrint(2)
test(2)
}
class Turtle {
fun penDown()
fun penUp()
fun turn(degrees: Double)
fun forward(pixels: Double)
}
with(Turtle()) {
penDown()
for(i in 1..4) {
forward(100.0)
List list = people.stream().map(Person::getName).collect(Collectors.toList());
val list = people.map { it.name }
int total = employees.stream()
.collect(Collectors.summingInt(Employee::getSalary)));
val total = employees.sumBy { it.salary }
public class SingleExpFun {
private BooleanSupplier trueOrFalse = new Random()::nextBoolean;
private boolean getNext(){
return trueOrFalse.getAsBoolean();
}
}
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}