public Map<String, Object> setRealmPrincipals(String realmName, Map<String, Object> principals) {
        if (realmName == null) {
            throw new NullPointerException("realmName argument cannot be null.");
        }
        if (this.realmPrincipals == null) {
            if (!CollectionUtils.isEmpty(principals)) {
                this.realmPrincipals = new HashMap<String, Map<String, Object>>();
                return this.realmPrincipals.put(realmName, new HashMap<String, Object>(principals));
            } else {
                return null;
            }
        } else {
            Map<String, Object> existingPrincipals = this.realmPrincipals.remove(realmName);
            if (!CollectionUtils.isEmpty(principals)) {
                this.realmPrincipals.put(realmName, new HashMap<String, Object>(principals));
            }
            return existingPrincipals;
        }
    }
Default implementation of the {@link PrincipalMap} interface.
<p>
*EXPERIMENTAL for Shiro 1.2 - DO NOT USE YET*

@since 1.2
core/src/main/java/org/apache/shiro/subject/SimplePrincipalMap.java