/** * Appends the string representation of each entry in {@code entries}, using the previously configured separator * and key-value separator, to {@code builder}. Identical to {@link #appendTo(Appendable, Iterable)}, except * that it does not throw {@link IOException}. * * @since 11.0 */ public StringBuilder appendTo(StringBuilder builder, Iterator<? extends Entry<?, ?>> entries) { try { appendTo((Appendable) builder, entries); } catch (IOException impossible) { throw new AssertionError(impossible); } return builder; }
/** * Returns a string containing the string representation of each entry in {@code entries}, using the previously * configured separator and key-value separator. * * @since 10.0 */ public String join(Iterable<? extends Entry<?, ?>> entries) { return join(entries.iterator()); }
/** * Returns a map joiner with the same behavior as this one, except automatically substituting {@code nullText} * for any provided null keys or values. */ public MapJoiner useForNull(String nullText) { return new MapJoiner(joiner.useForNull(nullText), keyValueSeparator); } }
/** * Appends the string representation of each entry in {@code entries}, using the previously configured separator * and key-value separator, to {@code builder}. Identical to {@link #appendTo(Appendable, Iterable)}, except * that it does not throw {@link IOException}. * * @since 10.0 */ public StringBuilder appendTo(StringBuilder builder, Iterable<? extends Entry<?, ?>> entries) { return appendTo(builder, entries.iterator()); }
/** * Appends the string representation of each entry in {@code entries}, using the previously configured separator * and key-value separator, to {@code appendable}. * * @since 10.0 */ public <A extends Appendable> A appendTo(A appendable, Iterable<? extends Entry<?, ?>> entries) throws IOException { return appendTo(appendable, entries.iterator()); }
/** * Returns a {@code MapJoiner} using the given key-value separator, and the same configuration as this * {@code Joiner} otherwise. */ public MapJoiner withKeyValueSeparator(String keyValueSeparator) { return new MapJoiner(this, keyValueSeparator); }
/** * Returns a string containing the string representation of each entry in {@code entries}, using the previously * configured separator and key-value separator. * * @since 11.0 */ public String join(Iterator<? extends Entry<?, ?>> entries) { return appendTo(new StringBuilder(), entries).toString(); }
/** * Appends the string representation of each entry of {@code map}, using the previously configured separator and * key-value separator, to {@code builder}. Identical to {@link #appendTo(Appendable, Map)}, except that it does * not throw {@link IOException}. */ public StringBuilder appendTo(StringBuilder builder, Map<?, ?> map) { return appendTo(builder, map.entrySet()); }
/** * Returns a string containing the string representation of each entry of {@code map}, using the previously * configured separator and key-value separator. */ public String join(Map<?, ?> map) { return join(map.entrySet()); }
/** * Appends the string representation of each entry of {@code map}, using the previously configured separator and * key-value separator, to {@code appendable}. */ public <A extends Appendable> A appendTo(A appendable, Map<?, ?> map) throws IOException { return appendTo(appendable, map.entrySet()); }