设计模式
Mavolas
在程序员的路上越走越远
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
静态内部类实现 Builder 构建者模式
直接上代码:public class HttpClient { private String mUrl; private String mMethod; private int mTimeOut; public String getUrl() { return mUrl; } public String getMetho...原创 2018-12-05 16:24:24 · 660 阅读 · 0 评论 -
JAVA单例模式(线程安全)
静态内部类实现:线程安全的,推荐使用public class Configurator { public static Configurator getInstance(){ return Holder.INSTANCE; } private static class Holder{ private static final Config...原创 2018-12-05 16:38:09 · 2256 阅读 · 0 评论 -
Builder构建者模式,构建者和客户端类分离
客户端类:1.初始化一个公共的构造方法2.builder 方法返回一个构建者public class RestClient { private String mUrl; private String mMehtod; private int mTimeout; public RestClient(String url, String mehtod, int...原创 2018-12-05 18:09:55 · 272 阅读 · 0 评论
分享