Given two methods that are somehow duplicate logic:
default void method_one(int a, int b) {
LOGGER.info("abc");
final long start = System.currentTimeMillis();
doMethod_A(a, b);
final long end = System.currentTimeMillis();
LOGGER.info(String.format("[abc] yep in %.2f sec", (end - start) / 1000f));
}
default void method_two(int c) {
LOGGER.info("xyz");
final long start = System.currentTimeMillis();
doMethod_B(c);
final long end = System.currentTimeMillis();
LOGGER.info(String.format("[xyz] yep in %.2f sec", (end - start) / 1000f));
}
I am thinking about how to avoid duplicate logic... any ideas?