格式化代码

This commit is contained in:
2018-06-17 20:31:19 +08:00
parent c47f63d484
commit d089585f2c
851 changed files with 32567 additions and 26715 deletions

View File

@@ -2,15 +2,23 @@ package concurrency;//: concurrency/Fat.java
// Objects that are expensive to create.
public class Fat {
private volatile double d; // Prevent optimization
private static int counter = 0;
private final int id = counter++;
public Fat() {
// Expensive, interruptible operation:
for(int i = 1; i < 10000; i++) {
d += (Math.PI + Math.E) / (double)i;
private volatile double d; // Prevent optimization
private static int counter = 0;
private final int id = counter++;
public Fat() {
// Expensive, interruptible operation:
for (int i = 1; i < 10000; i++) {
d += (Math.PI + Math.E) / (double) i;
}
}
public void operation() {
System.out.println(this);
}
@Override
public String toString() {
return "Fat id: " + id;
}
}
public void operation() { System.out.println(this); }
public String toString() { return "Fat id: " + id; }
} ///:~