synchronization.java

来自「think in java TIJ-3rd-edition-code.zip」· Java 代码 · 共 22 行

JAVA
22
字号
//: c09:Synchronization.java
// Using the Collections.synchronized methods.
import com.bruceeckel.simpletest.*;
import java.util.*;

public class Synchronization {
  public static void main(String[] args) {
    SimpleTest monitor =
      new SimpleTest("Synchronization");
    Collection c = 
      Collections.synchronizedCollection(
        new ArrayList());
    List list = Collections.synchronizedList(
      new ArrayList());
    Set s = Collections.synchronizedSet(
      new HashSet());
    Map m = Collections.synchronizedMap(
      new HashMap());
    monitor.expect(new String[] {
    });
  }
} ///:~

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?