private void writeObject(ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        boolean principalsExist = !CollectionUtils.isEmpty(realmPrincipals);
        out.writeBoolean(principalsExist);
        if (principalsExist) {
            out.writeObject(realmPrincipals);
        }
    }
Serialization write support.
<p/>
NOTE: Don't forget to change the serialVersionUID constant at the top of this class
if you make any backwards-incompatible serialization changes!!!
(use the JDK 'serialver' program for this)

@param out output stream provided by Java serialization
@throws IOException if there is a stream error
core/src/main/java/org/apache/shiro/subject/SimplePrincipalCollection.java