private boolean hasPort(List<ServicePort> ports,ServicePort port){
  for (  ServicePort aPort : ports) {
    if (Objects.equals(port.getPort(),aPort.getPort())) {
      return true;
    }
  }
  return false;
}

private boolean hasPort ( List < ServicePort > ports , ServicePort port ) { for ( ServicePort aPort : ports ) { if ( Objects . equals ( port . getPort ( ) , aPort . getPort ( ) ) ) { return true ; } } return false ; }
returns true if the given port can be found in the collection
