Source:
public Iterable<DataServiceMeta> getDataServices( final Repository repository, IMetaStore metaStore, final Function<Exception, Void> exceptionHandler ) { MetaStoreFactory<ServiceTrans> serviceTransFactory = getServiceTransFactory( metaStore ); List<ServiceTrans> serviceTransList; try { serviceTransList = serviceTransFactory.getElements(); } catch ( Exception e ) { exceptionHandler.apply( e ); serviceTransList = Collections.emptyList(); } Map<ServiceTrans.Reference, Supplier<TransMeta>> transMetaMap = FluentIterable.from( serviceTransList ). transformAndConcat( new Function<ServiceTrans, Iterable<ServiceTrans.Reference>>() { @Override public Iterable<ServiceTrans.Reference> apply( ServiceTrans serviceTrans ) { return serviceTrans.getReferences(); } } ). toMap( createTransMetaLoader( repository, exceptionHandler ) ); List<DataServiceMeta> dataServices = Lists.newArrayListWithExpectedSize( serviceTransList.size() ); for ( ServiceTrans serviceTrans : serviceTransList ) { Optional<TransMeta> transMeta = FluentIterable.from( serviceTrans.getReferences() ). transform( Functions.forMap( transMetaMap ) ). transform( Suppliers.<TransMeta>supplierFunction() ). firstMatch( Predicates.notNull() ); if ( transMeta.isPresent() ) { try { dataServices.add( getDataService( serviceTrans.getName(), transMeta.get() ) ); } catch ( Exception e ) { exceptionHandler.apply( e ); } } else { try { if ( SecurityHelper.getInstance().runAsSystem( () -> PentahoSessionHolder.getSession() != null && !ServiceTrans.isValid( repository ).apply( serviceTrans ) ) ) { serviceTransFactory.deleteElement( serviceTrans.getName() ); } } catch ( Exception e ) { exceptionHandler.apply( e ); } } } return dataServices; }

Target:
public Iterable<DataServiceMeta> getDataServices( final Repository repository, IMetaStore metaStore, final Function<Exception, Void> exceptionHandler ) { MetaStoreFactory<ServiceTrans> serviceTransFactory = getServiceTransFactory( metaStore ); List<ServiceTrans> serviceTransList; try { serviceTransList = serviceTransFactory.getElements(); } catch ( Exception e ) { exceptionHandler.apply( e ); serviceTransList = Collections.emptyList(); } Map<ServiceTrans.Reference, Supplier<TransMeta>> transMetaMap = FluentIterable.from( serviceTransList ). transformAndConcat( new Function<ServiceTrans, Iterable<ServiceTrans.Reference>>() { @Override public Iterable<ServiceTrans.Reference> apply( ServiceTrans serviceTrans ) { return serviceTrans.getReferences(); } } ). toMap( createTransMetaLoader( repository, exceptionHandler ) ); List<DataServiceMeta> dataServices = Lists.newArrayListWithExpectedSize( serviceTransList.size() ); for ( ServiceTrans serviceTrans : serviceTransList ) { Optional<TransMeta> transMeta = FluentIterable.from( serviceTrans.getReferences() ). transform( Functions.forMap( transMetaMap ) ). transform( Suppliers.<TransMeta>supplierFunction() ). firstMatch( Predicates.notNull() ); if ( transMeta.isPresent() ) { try { dataServices.add( getDataService( serviceTrans.getName(), transMeta.get() ) ); } catch ( Exception e ) { exceptionHandler.apply( e ); } } else { try { if ( PentahoSessionHolder.getSession() != null && SecurityHelper.getInstance().runAsSystem( () -> !ServiceTrans.isValid( repository ).apply( serviceTrans ) ) ) { serviceTransFactory.deleteElement( serviceTrans.getName() ); } } catch ( Exception e ) { exceptionHandler.apply( e ); } } } return dataServices; }