Untitled

 avatar
wyc1230
plain_text
5 months ago
757 B
7
Indexable
import java.util.*;
import java.util.stream.Collectors;

public class AuthorityProcessor {
    public static Map<String, List<String>> convertToMap(List<AuthorityDTO> authorityList) {
        return authorityList.stream()
            .collect(Collectors.toMap(
                AuthorityDTO::getUserLoginId, 
                authority -> authority.getZoneTypeList().stream()
                    .filter(zone -> Boolean.TRUE.equals(zone.getUsable()))
                    .map(ZoneTypeAuthorityDTO::getZoneTypeName)
                    .collect(Collectors.toList()),
                (existing, replacement) -> {
                    existing.addAll(replacement);
                    return existing;
                }
            ));
    }
}
Editor is loading...
Leave a Comment