IF(true, () -> github.deleteRepo(this));

This commit is contained in:
nora 2021-01-31 12:27:07 +01:00
parent d9f980f1a9
commit 7167e0ca80
2 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,28 @@
package com.github.nilstrieb.uselessclasses;
import java.util.function.Consumer;
/**
* This class adds a brand new syntax for if-statements!
* You just need to statically import the methods
*/
public class Ifs {
public static void IF(boolean condition, Statements onTrue) {
IF(condition, onTrue, () -> {});
}
public static void IF(boolean condition, Statements onTrue, Statements onFalse) {
if(condition){
onTrue.execute();
} else {
onFalse.execute();
}
}
interface Statements {
void execute();
}
}