Merge remote-tracking branch 'origin/GP-3979_ghidragon_program_caching--SQUASHED'

This commit is contained in:
ghidra1 2023-11-27 12:10:07 -05:00
commit 2e5b4fc22a
34 changed files with 2198 additions and 948 deletions

View file

@ -42,6 +42,16 @@ public class Dummy {
};
}
/**
* Creates a dummy consumer
* @return a dummy consumer
*/
public static <T, U> BiConsumer<T, U> biConsumer() {
return (t, u) -> {
// no-op
};
}
/**
* Creates a dummy function
* @param <T> the input type
@ -82,6 +92,17 @@ public class Dummy {
return c == null ? consumer() : c;
}
/**
* Returns the given consumer object if it is not {@code null}. Otherwise, a
* {@link #biConsumer()} is returned. This is useful to avoid using {@code null}.
*
* @param c the consumer function to check for {@code null}
* @return a non-null consumer
*/
public static <T, U> BiConsumer<T, U> ifNull(BiConsumer<T, U> c) {
return c == null ? biConsumer() : c;
}
/**
* Returns the given callback object if it is not {@code null}. Otherwise, a {@link #callback()}
* is returned. This is useful to avoid using {@code null}.