Skip to content

Instantly share code, notes, and snippets.

View rompetroll's full-sized avatar
💭
I may be slow to respond.

Sven Eigenbrodt rompetroll

💭
I may be slow to respond.
View GitHub Profile
@rompetroll
rompetroll / default.java
Created January 28, 2016 14:45
default methods
public class Test {
interface A {
default String a() {return "A";}
}
interface B {
default String b() {return "B";}
}
static class C implements A, B{}
@rompetroll
rompetroll / Compile.java
Last active May 13, 2017 06:36
java8 lambdas and exceptions
import java.util.function.Function;
import java.util.Optional;
public class Compile {
private <F,T> T runFun(Function<Optional<F>, T> fun, Optional<F> opt) {
return fun.apply(opt) ;
}
public void foo() {
Function<Optional<String>, String> fun = o -> o.orElseThrow(() -> new RuntimeException("nah"));
@rompetroll
rompetroll / diffreport.sh
Last active December 16, 2015 17:09
script for comparing two directories containing java packages (jar,war,ear,zip etc). The script basically builds input for http://pkgdiff.github.io/pkgdiff/ if you give it two "versions" of a distribution dir. The script only handles up to one level of nesting, so structures like these work: copy1 |_ enterprise.sar |_sub |_ some.jar |_ a.war cop…
#!/bin/bash
dir1=$1
dir2=$2
die() {
echo >&2 "$@"
exit 1
}