Skip to content

Instantly share code, notes, and snippets.

@houssemFat houssemFat/
Last active Feb 24, 2016

What would you like to do?
a simple join at java
/* package whatever; // don't place package name! */
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.Set;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
public static void main (String[] args) throws java.lang.Exception
char [] charArray = "Hello".toCharArray();
Set<String> strings = new LinkedHashSet<>();
for (char c : charArray) {
String out = String.join("-", strings) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.