免费制作购物网站网站免费搭建
免费制作购物网站,网站免费搭建,apmserv访问本地网站,网站开发团队需要几个人ios 静音模式您最近是否遵循Mute-Design-Pattern™编写了大量代码#xff1f; 例如 try {complex();logic();here();
}
catch (Exception ignore) {// Will never happen heheSystem.exit(-1);
}Java 8有一个更简单的方法#xff01; 只需将这个非常有用的工具添加到您的Ut… ios 静音模式 您最近是否遵循Mute-Design-Pattern™编写了大量代码 例如 try {complex();logic();here();
}
catch (Exception ignore) {// Will never happen heheSystem.exit(-1);
} Java 8有一个更简单的方法 只需将这个非常有用的工具添加到您的Utilities或Helper类 public class Helper {// 18395 lines of other code hereFunctionalInterfaceinterface CheckedRunnable {void run() throws Throwable;}public static void mute(CheckedRunnable r) {try {r.run();}catch (Throwable ignore) {// OK, better stay safeignore.printStackTrace();}}// 37831 lines of other code here
} 现在您可以将所有逻辑包装在这个漂亮的小包装中 mute(() - {complex();logic();here();
}); 做完了 更好的是在某些情况下您可以使用方法引用 try (Connection con ...;PreparedStatement stmt ...) {mute(stmt::executeUpdate);
}翻译自: https://www.javacodegeeks.com/2016/02/mute-design-pattern.htmlios 静音模式
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/92294.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!