public static <T>T findResourceByName(Iterable<HasMetadata> entities,Class<T> clazz,String name){
  if (entities != null) {
    for (    HasMetadata entity : entities) {
      if (clazz.isInstance(entity) && Objects.equals(name,getName(entity))) {
        return clazz.cast(entity);
      }
    }
  }
  return null;
}

public static < T > T findResourceByName ( Iterable < HasMetadata > entities , Class < T > clazz , String name ) { if ( entities != null ) { for ( HasMetadata entity : entities ) { if ( clazz . isInstance ( entity ) && Objects . equals ( name , getName ( entity ) ) ) { return clazz . cast ( entity ) ; } } } return null ; }
returns the resource of the given kind and name from the collection or null
