@ Nonnull public List < DockerSlaveTemplate > getTemplates ( Label label ) { List < DockerSlaveTemplate > dockerSlaveTemplates = new ArrayList <> ( ) ; for ( DockerSlaveTemplate t : templates ) { if ( isNull ( label ) && t . getMode ( ) == Node . Mode . NORMAL ) { dockerSlaveTemplates . add ( t ) ; } if ( nonNull ( label ) && label . matches ( t . getLabelSet ( ) ) ) { dockerSlaveTemplates . add ( t ) ; } } return dockerSlaveTemplates ; }
Multiple templates may have the same label .