|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.elasticsearch.util.inject.internal.Join
public final class Join
Utility for joining pieces of text separated by a delimiter. It can handle
iterators, collections, arrays, and varargs, and can append to any
Appendable or just return a String. For example,
join(":", "a", "b", "c") returns "a:b:c".
All methods of this class throw NullPointerException when a value
of null is supplied for any parameter. The elements within the
collection, iterator, array, or varargs parameter list may be null --
these will be represented in the output by the string "null".
| Nested Class Summary | |
|---|---|
static class |
Join.JoinException
Exception thrown in response to an IOException from the supplied
Appendable. |
| Method Summary | ||
|---|---|---|
static java.lang.String |
join(java.lang.String delimiter,
java.lang.Iterable<?> tokens)
Returns a string containing the tokens, converted to strings if
necessary, separated by delimiter. |
|
static java.lang.String |
join(java.lang.String delimiter,
java.util.Iterator<?> tokens)
Returns a string containing the tokens, converted to strings if
necessary, separated by delimiter. |
|
static java.lang.String |
join(java.lang.String delimiter,
java.lang.Object[] tokens)
Returns a string containing the tokens, converted to strings if
necessary, separated by delimiter. |
|
static java.lang.String |
join(java.lang.String delimiter,
java.lang.Object firstToken,
java.lang.Object... otherTokens)
Returns a string containing the tokens, converted to strings if
necessary, separated by delimiter. |
|
static java.lang.String |
join(java.lang.String keyValueSeparator,
java.lang.String entryDelimiter,
java.util.Map<?,?> map)
Returns a string containing the contents of map, with entries
separated by entryDelimiter, and keys and values separated with
keyValueSeparator. |
|
static
|
join(T appendable,
java.lang.String delimiter,
java.lang.Iterable<?> tokens)
Appends each of the tokens to appendable, separated by
delimiter. |
|
static
|
join(T appendable,
java.lang.String delimiter,
java.util.Iterator<?> tokens)
Appends each of the tokens to appendable, separated by
delimiter. |
|
static
|
join(T appendable,
java.lang.String delimiter,
java.lang.Object[] tokens)
Appends each of the tokens to appendable, separated by
delimiter. |
|
static
|
join(T appendable,
java.lang.String delimiter,
java.lang.Object firstToken,
java.lang.Object... otherTokens)
Appends each of the tokens to appendable, separated by
delimiter. |
|
static
|
join(T appendable,
java.lang.String keyValueSeparator,
java.lang.String entryDelimiter,
java.util.Map<?,?> map)
Appends the contents of map to appendable, with entries
separated by entryDelimiter, and keys and values separated with
keyValueSeparator. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String join(java.lang.String delimiter,
java.lang.Iterable<?> tokens)
tokens, converted to strings if
necessary, separated by delimiter. If tokens is empty, it
returns an empty string.
Each token will be converted to a CharSequence using
String.valueOf(Object), if it isn't a CharSequence already.
Note that this implies that null tokens will be appended as the
four-character string "null".
delimiter - a string to append between every element, but not at the
beginning or endtokens - objects to append
public static java.lang.String join(java.lang.String delimiter,
java.lang.Object[] tokens)
tokens, converted to strings if
necessary, separated by delimiter. If tokens is empty, it
returns an empty string.
Each token will be converted to a CharSequence using
String.valueOf(Object), if it isn't a CharSequence already.
Note that this implies that null tokens will be appended as the
four-character string "null".
delimiter - a string to append between every element, but not at the
beginning or endtokens - objects to append
public static java.lang.String join(java.lang.String delimiter,
@Nullable
java.lang.Object firstToken,
java.lang.Object... otherTokens)
tokens, converted to strings if
necessary, separated by delimiter.
Each token will be converted to a CharSequence using
String.valueOf(Object), if it isn't a CharSequence already.
Note that this implies that null tokens will be appended as the
four-character string "null".
delimiter - a string to append between every element, but not at the
beginning or endfirstToken - the first object to appendotherTokens - subsequent objects to append
public static java.lang.String join(java.lang.String delimiter,
java.util.Iterator<?> tokens)
tokens, converted to strings if
necessary, separated by delimiter. If tokens is empty, it
returns an empty string.
Each token will be converted to a CharSequence using
String.valueOf(Object), if it isn't a CharSequence already.
Note that this implies that null tokens will be appended as the
four-character string "null".
delimiter - a string to append between every element, but not at the
beginning or endtokens - objects to append
public static java.lang.String join(java.lang.String keyValueSeparator,
java.lang.String entryDelimiter,
java.util.Map<?,?> map)
map, with entries
separated by entryDelimiter, and keys and values separated with
keyValueSeparator.
Each key and value will be converted to a CharSequence using
String.valueOf(Object), if it isn't a CharSequence already.
Note that this implies that null tokens will be appended as the
four-character string "null".
keyValueSeparator - a string to append between every key and its
associated valueentryDelimiter - a string to append between every entry, but not at
the beginning or endmap - the map containing the data to join
public static <T extends java.lang.Appendable> T join(T appendable,
java.lang.String delimiter,
java.lang.Iterable<?> tokens)
tokens to appendable, separated by
delimiter.
Each token will be converted to a CharSequence using
String.valueOf(Object), if it isn't a CharSequence already.
Note that this implies that null tokens will be appended as the
four-character string "null".
appendable - the object to append the results todelimiter - a string to append between every element, but not at the
beginning or endtokens - objects to append
Appendable instance that was passed in
Join.JoinException - if an IOException occurs
public static <T extends java.lang.Appendable> T join(T appendable,
java.lang.String delimiter,
java.lang.Object[] tokens)
tokens to appendable, separated by
delimiter.
Each token will be converted to a CharSequence using
String.valueOf(Object), if it isn't a CharSequence already.
Note that this implies that null tokens will be appended as the
four-character string "null".
appendable - the object to append the results todelimiter - a string to append between every element, but not at the
beginning or endtokens - objects to append
Appendable instance that was passed in
Join.JoinException - if an IOException occurs
public static <T extends java.lang.Appendable> T join(T appendable,
java.lang.String delimiter,
@Nullable
java.lang.Object firstToken,
java.lang.Object... otherTokens)
tokens to appendable, separated by
delimiter.
Each token will be converted to a CharSequence using
String.valueOf(Object), if it isn't a CharSequence already.
Note that this implies that null tokens will be appended as the
four-character string "null".
appendable - the object to append the results todelimiter - a string to append between every element, but not at the
beginning or endfirstToken - the first object to appendotherTokens - subsequent objects to append
Appendable instance that was passed in
Join.JoinException - if an IOException occurs
public static <T extends java.lang.Appendable> T join(T appendable,
java.lang.String delimiter,
java.util.Iterator<?> tokens)
tokens to appendable, separated by
delimiter.
Each token will be converted to a CharSequence using
String.valueOf(Object), if it isn't a CharSequence already.
Note that this implies that null tokens will be appended as the
four-character string "null".
appendable - the object to append the results todelimiter - a string to append between every element, but not at the
beginning or endtokens - objects to append
Appendable instance that was passed in
Join.JoinException - if an IOException occurs
public static <T extends java.lang.Appendable> T join(T appendable,
java.lang.String keyValueSeparator,
java.lang.String entryDelimiter,
java.util.Map<?,?> map)
map to appendable, with entries
separated by entryDelimiter, and keys and values separated with
keyValueSeparator.
Each key and value will be converted to a CharSequence using
String.valueOf(Object), if it isn't a CharSequence already.
Note that this implies that null tokens will be appended as the
four-character string "null".
appendable - the object to append the results tokeyValueSeparator - a string to append between every key and its
associated valueentryDelimiter - a string to append between every entry, but not at
the beginning or endmap - the map containing the data to join
Appendable instance that was passed in
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||