⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e415. determining if a preference node exists.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
A preference node is automatically created whenever Preferences.node(), Preferences.userNodeForPackage(), or Preferences.systemNodeForPackage() is called. To avoid creating a node, you should first check to see if it exists. 
    try {
        // Check if a node exists
        boolean exists = Preferences.userRoot().nodeExists("/foo"); // false
    
        // Get the node
        Preferences.userRoot().node("/foo");
    
        // Getting a non-existent node automatically creates it
        exists = Preferences.userRoot().nodeExists("/foo"); // true
    
        // Remove the node
        Preferences prefs = Preferences.userRoot().node("/foo");
        prefs.removeNode();
    
        // The following would cause an IllegalStateException
        //exists = prefs.nodeExists("/foo");
    
        // Use the following to determine if the node has been removed
        exists = prefs.nodeExists(""); // false
    } catch (BackingStoreException e) {
    }

 Related Examples 

⌨️ 快捷键说明

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