...
Code Block | ||
---|---|---|
| ||
public final class Helper {
private final int n;
public Helper(int n) {
this.n = n;
}
// Other fields and methods, all fields are final
}
final class Foo {
private Helper helper = null;
public Helper getHelper() {
if (helper == null) {
synchronized (this) {
if (helper == null) {
helper = new Helper(42);
}
}
}
return helper;
}
}
|
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="1ea9934761fbabf7-65a6ecf2-4f034a27-bd92bf92-33734c537096d1f296a6d919"><ac:plain-text-body><![CDATA[ | [[API 2006 | AA. References#API 06]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c82a31b162922d70-8a1cf7fd-40b445c9-b3469bab-d1e4b90e19304c588d64ace2"><ac:plain-text-body><![CDATA[ | [[Bloch 2001 | AA. References#Bloch 01]] | Item 48. Synchronize access to shared mutable data | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0eac5848bfb8d547-2d0b6dcd-41b74c24-91e2ac7f-47c865f68f620b8cbc90f78f"><ac:plain-text-body><![CDATA[ | [[Bloch 2008 | AA. References#Bloch 08]] | Item 71. Use lazy initialization judiciously]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8d072cc568480f5b-766cad64-45114927-a4e2b734-446b9b242f882fe6828422bc"><ac:plain-text-body><![CDATA[ | [[JLS 2005 | AA. References#JLS 05]] | §12.4, Initialization of Classes and Interfaces | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6251110c74ac6b34-86a9d956-40944b32-8b6da1ee-6c85fbb716f39fb8288ab99d"><ac:plain-text-body><![CDATA[ | [[Pugh 2004 | AA. References#Pugh 04]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
...