Java - Write code to Convert Set<String> To String

Requirements

Write code to Convert Set<String> To String

Demo

//package com.book2s;

import java.util.Set;

public class Main {
    public static String setToString(Set<String> set) {
        StringBuilder sb = new StringBuilder();
        for (String s : set) {
            sb.append(s);/* www  .j a  v a 2 s. c  o m*/
            sb.append(" ");
        }
        return sb.toString();
    }
}

Related Topic