public <T> T oneByType(Class<T> type) {
        if (CollectionUtils.isEmpty(this.combinedPrincipals)) {
            return null;
        }
        for (Object value : this.combinedPrincipals.values()) {
            if (type.isInstance(value)) {
                return type.cast(value);
            }
        }
        return null;
    }
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