/** * 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()); }
private String computeToString() { StringBuilder builder = new StringBuilder().append(type).append('/').append(subtype); if (!parameters.isEmpty()) { builder.append("; "); Multimap<String, String> quotedParameters = Multimaps.transformValues( parameters, new Function<String, String>() { @Override public String apply(String value) { return TOKEN_MATCHER.matchesAllOf(value) ? value : escapeAndQuote(value); } }); PARAMETER_JOINER.appendTo(builder, quotedParameters.entries()); } return builder.toString(); }
/** * 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 */ @Beta @CanIgnoreReturnValue 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 11.0 */ @Beta public String join(Iterator<? extends Entry<?, ?>> entries) { return appendTo(new StringBuilder(), entries).toString(); }
/** * 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 */ @Beta @CanIgnoreReturnValue 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 */ @Beta @CanIgnoreReturnValue public <A extends Appendable> A appendTo(A appendable, Iterable<? extends Entry<?, ?>> entries) throws IOException { return appendTo(appendable, entries.iterator()); }
/** * 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 */ @Beta public String join(Iterable<? extends Entry<?, ?>> entries) { return join(entries.iterator()); }
/** * 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}. */ @CanIgnoreReturnValue public StringBuilder appendTo(StringBuilder builder, Map<?, ?> map) { return appendTo(builder, map.entrySet()); }
/** * Appends the string representation of each entry of {@code map}, using the previously * configured separator and key-value separator, to {@code appendable}. */ @CanIgnoreReturnValue public <A extends Appendable> A appendTo(A appendable, Map<?, ?> map) throws IOException { return appendTo(appendable, map.entrySet()); }
/** * 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); } }
/** * 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); }
@Override public String toString() { Joiner.MapJoiner mapJoiner = Joiner.on(',').withKeyValueSeparator("="); return "NamespaceTableAndRegionInfo [name=" + name + ", tableAndRegionInfo=" + mapJoiner.join(tableAndRegionInfo) + "]"; } }