22

钻钻 “单例” 的牛角尖

 5 years ago
source link: https://juejin.im/post/5cb98c94f265da03a743ef6c
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
上篇文章 走进 JDK 之 Enum 提到过,枚举很适合用来实现单例模式。实际上,在 Effective Java 中也提到过(果然英雄所见略同): 单元素的枚举类型经常成为实现 Singleton 的最佳方法 。 首先什么是单例?就一条基本原则,单例对象

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK