public Map < String , PortMapping > ports ( ) { final ImmutableMap . Builder < String , PortMapping > builder = ImmutableMap . builder ( ) ; for ( final Map . Entry < String , PortMapping > e : job . getPorts ( ) . entrySet ( ) ) { final PortMapping mapping = e . getValue ( ) ; builder . put ( e . getKey ( ) , mapping . hasExternalPort ( ) ? mapping : mapping . withExternalPort ( checkNotNull ( ports . get ( e . getKey ( ) ) ) ) ) ; } return builder . build ( ) ; }
Get final port mappings using allocated ports .