Darth Bolek created DIRAPI-360:
----------------------------------

             Summary: add stream convenient methods to class Attribute
                 Key: DIRAPI-360
                 URL: https://issues.apache.org/jira/browse/DIRAPI-360
             Project: Directory Client API
          Issue Type: Improvement
    Affects Versions: 2.0.1
            Reporter: Darth Bolek


When attribute has multiple values (groupOfUniqueNames -> uniqueMember) there 
is no stream convenient way of processing all of the values.

 

what to do:

add methods to class: org.apache.directory.api.ldap.model.entry.Attribute

Collection<String> getStringValues()

possibly also other methods with other/generic data types.

 

example:

Before (that is right now):

 
{code:java}
Set<Dn> m = entry.getAttributes().stream()
                .filter(x -> group_fields.contains(x.getUpId()) )
                .flatMap(y -> {
                                Set<String> tmpSet = new HashSet<String>();
                                y.forEach(z -> tmpSet.add(z.getString()));
                                return tmpSet.stream();
                } )
                .map(z -> LDAPUtil.getDn(z))
                .collect(Collectors.toSet());
{code}
 

After:
{code:java}
Set<Dn> m = entry.getAttributes().stream()
                .filter(x -> group_fields.contains(x.getUpId()) )
                .flatMap(y -> y.getStringValues().stream() )
                .map(z -> LDAPUtil.getDn(z))
                .collect(Collectors.toSet());

{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to