I would like to get the feedback about this code:import java.util.HashSet;import java.util.Queue;import java.util.Set;public class Utils {    private final Set<String> permissionsSet = new HashSet<String>(50);    private PlatformModuleModelLocator modelLocator = Lookup.getDefault().lookup(PlatformModuleModelLocator.class);    public Boolean hasUserPermission(String permission) {        synchronized (permissionsSet) {            if (permissionsSet.isEmpty() && modelLocator.getUserSession() != null) {                Queue<String> userPermissions = modelLocator.getUserSession().getUserPermissionsFromDB();                for (String userPermission : userPermissions) {                    permissionsSet.add(userPermission);                }            }        }        return permissionsSet.contains(permission);    }}I've tried to fill Set only after first call in multi-threading environment. Can i do it without synchronized block? Please suggest some variants.PS:  It's not from Utils actually, i've just copied this method from application class. PlatformModuleModelLocator returns user permissions like Queue strings. It can have duplicates and i have to iterate over this queue when i need to check permissions. So i decided optimize this block and put this lines to Set.But it not so matter I look for effective method for lazy initialization collections. How can i initialize my Set after first call?
Lazily load permissions from database in multithreading environment
java;multithreading;database;authorization;lazy