public <T> Collection<T> byType(Class<T> type) {
        if (CollectionUtils.isEmpty(this.combinedPrincipals)) {
            return Collections.emptySet();
        }
        Collection<T> instances = null;
        for (Object value : this.combinedPrincipals.values()) {
            if (type.isInstance(value)) {
                if (instances == null) {
                    instances = new ArrayList<T>();
                }
                instances.add(type.cast(value));
            }
        }
        return instances != null ? instances : Collections.<T>emptyList();
    }
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