?? e407. determining if a preference node contains a specific value.txt
字號:
This example enumerates the key/value pairs in a preference node and checks each value for a match.
// Returns the key of a preference whose value matches the specified value;
// null is returned if no such key exists.
public static String containsValue(Preferences node, String value) {
try {
// Get all the keys
String[] keys = node.keys();
// Scan the keys
for (int i=0; i<keys.length; i++) {
if (value.equals(node.get(keys[i], null))) {
return keys[i];
}
}
} catch (BackingStoreException e) {
}
return null;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -