get User Preferences - Java java.util.prefs

Java examples for java.util.prefs:Preferences

Description

get User Preferences

Demo Code


//package com.java2s;
import java.util.HashMap;
import java.util.prefs.Preferences;

public class Main {
    private static HashMap<String, Preferences> userPreferences = new HashMap<String, Preferences>();

    public static Preferences getUserPreferences(String name) {
        Preferences pref = null;/*from  ww w. j  a v  a2s. c o  m*/

        if (userPreferences.containsKey(name)) {
            return userPreferences.get(name);
        }

        pref = Preferences.userRoot().node(name);
        userPreferences.put(name, pref);

        return pref;
    }
}

Related Tutorials