private static Map < Integer , Map < String , String > > createOrgMinistryMap ( final Map < Integer , List < GovernmentBodyAnnualSummary > > data ) { final Map < Integer , Map < String , String > > orgMinistryMap = new HashMap <> ( ) ; final Set < Entry < Integer , List < GovernmentBodyAnnualSummary > > > entrySet = data . entrySet ( ) ; for ( final Entry < Integer , List < GovernmentBodyAnnualSummary > > entry : entrySet ) { orgMinistryMap . put ( entry . getKey ( ) , entry . getValue ( ) . stream ( ) . collect ( Collectors . groupingBy ( t -> t . getOrgNumber ( ) . replaceAll ( "-" , "" ) , Collectors . collectingAndThen ( Collectors . toList ( ) , values -> values . get ( 0 ) . getMinistry ( ) ) ) ) ) ; } return orgMinistryMap ; }
Creates the org ministry map .