public Joiner skipNulls() {
    return new Joiner(this) {
      @Override
      public <A extends Appendable> A appendTo(A appendable, Iterator<?> parts) throws IOException {
        checkNotNull(appendable, "appendable");
        checkNotNull(parts, "parts");
        while (parts.hasNext()) {
          Object part = parts.next();
          if (part != null) {
            appendable.append(Joiner.this.toString(part));
            break;
          }
        }
        while (parts.hasNext()) {
          Object part = parts.next();
          if (part != null) {
            appendable.append(separator);
            appendable.append(Joiner.this.toString(part));
          }
        }
        return appendable;
      }

      @Override
      public Joiner useForNull(String nullText) {
        throw new UnsupportedOperationException("already specified skipNulls");
      }

      @Override
      public MapJoiner withKeyValueSeparator(String kvs) {
        throw new UnsupportedOperationException("can't use .skipNulls() with maps");
      }
    };
  }
public Joiner skipNulls() {
    return new Joiner(this) {
      @Override
      public <A extends Appendable> A appendTo(A appendable, Iterator<?> parts) throws IOException {
        checkNotNull(appendable, "appendable");
        checkNotNull(parts, "parts");
        while (parts.hasNext()) {
          Object part = parts.next();
          if (part != null) {
            appendable.append(Joiner.this.toString(part));
            break;
          }
        }
        while (parts.hasNext()) {
          Object part = parts.next();
          if (part != null) {
            appendable.append(separator);
            appendable.append(Joiner.this.toString(part));
          }
        }
        return appendable;
      }

      @Override
      public Joiner useForNull(String nullText) {
        throw new UnsupportedOperationException("already specified skipNulls");
      }

      @Override
      public MapJoiner withKeyValueSeparator(String kvs) {
        throw new UnsupportedOperationException("can't use .skipNulls() with maps");
      }
    };
  }
public Joiner skipNulls ( ) { return new Joiner ( this ) { @ Override public < A extends Appendable > A appendTo ( A appendable , Iterator < ? > parts ) throws IOException { checkNotNull ( appendable , "appendable" ) ; checkNotNull ( parts , "parts" ) ; while ( parts . hasNext ( ) ) { Object part = parts . next ( ) ; if ( part != null ) { appendable . append ( Joiner . this . toString ( part ) ) ; break ; } } while ( parts . hasNext ( ) ) { Object part = parts . next ( ) ; if ( part != null ) { appendable . append ( separator ) ; appendable . append ( Joiner . this . toString ( part ) ) ; } } return appendable ; } @ Override public Joiner useForNull ( String nullText ) { throw new UnsupportedOperationException ( "already specified skipNulls" ) ; } @ Override public MapJoiner withKeyValueSeparator ( String kvs ) { throw new UnsupportedOperationException ( "can't use .skipNulls() with maps" ) ; } } ; }
Returns a joiner with the same behavior as this joiner, except automatically skipping over any
provided null elements.
Returns a joiner with the same behavior as this joiner except automatically skipping over any provided null elements .