📄 attributestore.java
字号:
package net.jcip.examples;import java.util.*;import java.util.regex.*;import net.jcip.annotations.*;/** * AttributeStore * <p/> * Holding a lock longer than necessary * * @author Brian Goetz and Tim Peierls */@ThreadSafepublic class AttributeStore { @GuardedBy("this") private final Map<String, String> attributes = new HashMap<String, String>(); public synchronized boolean userLocationMatches(String name, String regexp) { String key = "users." + name + ".location"; String location = attributes.get(key); if (location == null) return false; else return Pattern.matches(regexp, location); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -