cn.dreampie.common.util
类 Joiner

java.lang.Object
  继承者 cn.dreampie.common.util.Joiner

public class Joiner
extends Object

Created by ice on 14-12-29.


嵌套类摘要
static class Joiner.MapJoiner
          An object that joins map entries in the same manner as Joiner joins iterables and arrays.
 
方法摘要
<A extends Appendable>
A
appendTo(A appendable, Iterable<?> parts)
          Appends the string representation of each of parts, using the previously configured separator between each, to appendable.
<A extends Appendable>
A
appendTo(A appendable, Iterator<?> parts)
          Appends the string representation of each of parts, using the previously configured separator between each, to appendable.
<A extends Appendable>
A
appendTo(A appendable, Object[] parts)
          Appends the string representation of each of parts, using the previously configured separator between each, to appendable.
<A extends Appendable>
A
appendTo(A appendable, Object first, Object second, Object... rest)
          Appends to appendable the string representation of each of the remaining arguments.
 StringBuilder appendTo(StringBuilder builder, Iterable<?> parts)
          Appends the string representation of each of parts, using the previously configured separator between each, to builder.
 StringBuilder appendTo(StringBuilder builder, Iterator<?> parts)
          Appends the string representation of each of parts, using the previously configured separator between each, to builder.
 StringBuilder appendTo(StringBuilder builder, Object[] parts)
          Appends the string representation of each of parts, using the previously configured separator between each, to builder.
 StringBuilder appendTo(StringBuilder builder, Object first, Object second, Object... rest)
          Appends to builder the string representation of each of the remaining arguments.
 String join(Iterable<?> parts)
          Returns a string containing the string representation of each of parts, using the previously configured separator between each.
 String join(Iterator<?> parts)
          Returns a string containing the string representation of each of parts, using the previously configured separator between each.
 String join(Object[] parts)
          Returns a string containing the string representation of each of parts, using the previously configured separator between each.
 String join(Object first, Object second, Object... rest)
          Returns a string containing the string representation of each argument, using the previously configured separator between each.
static Joiner on(char separator)
          Returns a joinKit which automatically places separator between consecutive elements.
static Joiner on(String separator)
          Returns a joinKit which automatically places separator between consecutive elements.
 Joiner skipNulls()
          Returns a joinKit with the same behavior as this joinKit, except automatically skipping over any provided null elements.
 Joiner useForNull(String nullText)
          Returns a joinKit with the same behavior as this one, except automatically substituting nullText for any provided null elements.
 Joiner.MapJoiner withKeyValueSeparator(String keyValueSeparator)
          Returns a MapJoiner using the given key-value separator, and the same configuration as this Joiner otherwise.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

on

public static Joiner on(String separator)
Returns a joinKit which automatically places separator between consecutive elements.


on

public static Joiner on(char separator)
Returns a joinKit which automatically places separator between consecutive elements.


appendTo

public <A extends Appendable> A appendTo(A appendable,
                                         Iterable<?> parts)
                              throws IOException
Appends the string representation of each of parts, using the previously configured separator between each, to appendable.

抛出:
IOException

appendTo

public <A extends Appendable> A appendTo(A appendable,
                                         Iterator<?> parts)
                              throws IOException
Appends the string representation of each of parts, using the previously configured separator between each, to appendable.

抛出:
IOException
从以下版本开始:
11.0

appendTo

public final <A extends Appendable> A appendTo(A appendable,
                                               Object[] parts)
                                    throws IOException
Appends the string representation of each of parts, using the previously configured separator between each, to appendable.

抛出:
IOException

appendTo

public final <A extends Appendable> A appendTo(A appendable,
                                               Object first,
                                               Object second,
                                               Object... rest)
                                    throws IOException
Appends to appendable the string representation of each of the remaining arguments.

抛出:
IOException

appendTo

public final StringBuilder appendTo(StringBuilder builder,
                                    Iterable<?> parts)
Appends the string representation of each of parts, using the previously configured separator between each, to builder. Identical to appendTo(Appendable, Iterable), except that it does not throw IOException.


appendTo

public final StringBuilder appendTo(StringBuilder builder,
                                    Iterator<?> parts)
Appends the string representation of each of parts, using the previously configured separator between each, to builder. Identical to appendTo(Appendable, Iterable), except that it does not throw IOException.

从以下版本开始:
11.0

appendTo

public final StringBuilder appendTo(StringBuilder builder,
                                    Object[] parts)
Appends the string representation of each of parts, using the previously configured separator between each, to builder. Identical to appendTo(Appendable, Iterable), except that it does not throw IOException.


appendTo

public final StringBuilder appendTo(StringBuilder builder,
                                    Object first,
                                    Object second,
                                    Object... rest)
Appends to builder the string representation of each of the remaining arguments. Identical to appendTo(Appendable, Object, Object, Object...), except that it does not throw IOException.


join

public final String join(Iterable<?> parts)
Returns a string containing the string representation of each of parts, using the previously configured separator between each.


join

public final String join(Iterator<?> parts)
Returns a string containing the string representation of each of parts, using the previously configured separator between each.

从以下版本开始:
11.0

join

public final String join(Object[] parts)
Returns a string containing the string representation of each of parts, using the previously configured separator between each.


join

public final String join(Object first,
                         Object second,
                         Object... rest)
Returns a string containing the string representation of each argument, using the previously configured separator between each.


useForNull

public Joiner useForNull(String nullText)
Returns a joinKit with the same behavior as this one, except automatically substituting nullText for any provided null elements.


skipNulls

public Joiner skipNulls()
Returns a joinKit with the same behavior as this joinKit, except automatically skipping over any provided null elements.


withKeyValueSeparator

public Joiner.MapJoiner withKeyValueSeparator(String keyValueSeparator)
Returns a MapJoiner using the given key-value separator, and the same configuration as this Joiner otherwise.



Copyright © 2015. All rights reserved.