OSCore (Open Symphony Core) is a java library with lot of utilities and reusable components. This requires the libraries oscore-2.2.6.jar, mail.jar to be in classpath. The following example shows using TextUtils.join() API.
package com.bethecoder.tutorials.oscore; import java.util.Arrays; import com.opensymphony.util.TextUtils; public class JoinIteratorTest { /** * @param args */ public static void main(String[] args) { String joinStr = TextUtils.join(".", Arrays.asList(1, 2, 3, 4, 5, 6).iterator()); System.out.println(joinStr); joinStr = TextUtils.join("-:-", Arrays.asList("ONE", "TWO", "THREE", "FOUR").iterator()); System.out.println(joinStr); } }
1.2.3.4.5.6 ONE-:-TWO-:-THREE-:-FOUR