|
sdr 0.7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.cscott.sdr.util.ListUtils
public final class ListUtils
Convenience functions for lists and strings.
Method Summary | |
---|---|
static String |
join(Collection<?> c,
String insert)
Return the string created by inserting insert between
the members of c . |
static String |
join(Collection<?> c,
String insert,
String preFinal)
Return the string created by inserting insert between
the members of c , and preFinal before the last one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String join(Collection<?> c, String insert)
insert
between
the members of c
.
js> ListUtils.join(Tools.l(1), " + ") 1.0 js> ListUtils.join(Tools.l(1, 2), " + ") 1.0 + 2.0 js> ListUtils.join(Tools.l(1, 2, 3), " + ") 1.0 + 2.0 + 3.0
public static String join(Collection<?> c, String insert, String preFinal)
insert
between
the members of c
, and preFinal
before the last one.
js> ListUtils.join(Tools.l("apples"), ", ", " or ") apples js> ListUtils.join(Tools.l("apples", "oranges"), ", ", " or ") apples or oranges js> ListUtils.join(Tools.l("apples", "oranges", "pears"), ", ", " or ") apples, oranges or pears
js> ListUtils.join(Tools.l(1, 2, 3), " + ", " - ") 1.0 + 2.0 - 3.0
|
sdr 0.7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |