Mercurial > hg4j
diff src/org/tmatesoft/hg/internal/Internals.java @ 407:30922c728341 smartgit3
Better multiline log printout; options to tune default log output
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 16 Mar 2012 12:51:03 +0100 |
parents | b015f3918120 |
children | 0f5696623512 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/Internals.java Mon Mar 05 15:15:49 2012 +0100 +++ b/src/org/tmatesoft/hg/internal/Internals.java Fri Mar 16 12:51:03 2012 +0100 @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.StringTokenizer; @@ -320,4 +321,22 @@ public boolean shallCacheRevlogs() { return shallCacheRevlogsInRepo; } + + public static <T> CharSequence join(Iterable<T> col, CharSequence separator) { + if (col == null) { + return String.valueOf(col); + } + Iterator<T> it = col.iterator(); + if (!it.hasNext()) { + return "[]"; + } + String v = String.valueOf(it.next()); + StringBuilder sb = new StringBuilder(v); + while (it.hasNext()) { + sb.append(separator); + v = String.valueOf(it.next()); + sb.append(v); + } + return sb; + } }