public Partitions prunePartitions(Set<String> validPartitions){
  if (validPartitions != null && !validPartitions.isEmpty()) {
    partitions.retainAll(validPartitions);
  }
  return this;
}

public Partitions prunePartitions ( Set < String > validPartitions ) { if ( validPartitions != null && ! validPartitions . isEmpty ( ) ) { partitions . retainAll ( validPartitions ) ; } return this ; }
prunes this instance so that it retains only the partitions included in the given set . no operation takes place if the given set is null or empty .
