private Map < Environment , Collection < ArtifactIdentifier > > getArtifactIdentifiers ( List < Environment > environments ) { Map < Environment , Collection < ArtifactIdentifier > > rt = new HashMap <> ( ) ; for ( Environment env : environments ) { Set < ArtifactIdentifier > ids = new HashSet <> ( ) ; if ( env . getUnits ( ) != null ) { for ( DeployableUnit du : env . getUnits ( ) ) { String artifactName = du . getName ( ) ; String artifactExtension = null ; int dotIdx = artifactName . lastIndexOf ( ' ' ) ; if ( dotIdx > 0 ) { // If idx is 0 starts with a dot... in which case not an extension artifactName = artifactName . substring ( 0 , dotIdx ) ; artifactExtension = artifactName . substring ( dotIdx ) ; } ArtifactIdentifier id = new ArtifactIdentifier ( null , artifactName , du . getVersion ( ) , null , artifactExtension ) ; ids . add ( id ) ; } } rt . put ( env , new ArrayList <> ( ids ) ) ; } return rt ; }
this is here for future expansion