public List < String > getRoleNames ( final Optional < ? extends Subject > subjectOption ) { final List < String > roleNames = new ArrayList <> ( ) ; subjectOption . ifPresent ( subject -> { final List < ? extends Role > roles = subject . getRoles ( ) ; if ( roles != null ) { roleNames . addAll ( roles . stream ( ) . filter ( Objects :: nonNull ) . map ( Role :: getName ) . collect ( Collectors . toList ( ) ) ) ; } } ) ; return roleNames ; }
Gets the role name of each role held .