public HostAndPort withDefaultPort ( int defaultPort ) { checkArgument ( isValidPort ( defaultPort ) ) ; if ( hasPort ( ) || port == defaultPort ) { return this ; } return new HostAndPort ( host , defaultPort , hasBracketlessColons ) ; }
Provide a default port if the parsed string contained only a host .