Java : add quotes to data in a CSV file

I am trying to add quotes to data in a CSV file. Below is the approach i have done it. I am sure there is a simpler way using regex or other methods. Would like to know that.

    public List<String> addQuotes2List(List<String> list, String delimiter){
        List<String> tempList = new ArrayList<>();
        String temp="", value;
        Integer i=-1, j=0;

        for(String s1: list){
            //println("S1 - "+s1+" - "+Arrays.asList(s1.split("//"+delimiter)) );
            i++;

tempList = Arrays.asList(s1.split("//"+delimiter));

            //println(tempList);
            temp="";j=0;
            for(String s2:tempList){
                if(j>0)
                    temp+=delimiter;                

                //println("S2 - "+s2);
                temp+="/""+s2+"/"";

                j++;                
            }
            list.set(i, temp);          
        }

        return list;
    }

Input

tempList.clear();
    tempList.add("Sushanth.Bobby.Lloyds");
    tempList.add("Watch.a.lot.of.movies");
    tempList.add("main.hobby.is.programming");
    tempList.add("programming.is.dangerous.addiction.of.all");
    tempList = a.addQuotes2List(tempList,".");

    println("tempList - "+tempList.size());
    for(String s:tempList)
        println(s);

output

tempList - 4
"Sushanth"."Bobby"."Lloyds"
"Watch"."a"."lot"."of"."movies"
"main"."hobby"."is"."programming"
"programming"."is"."dangerous"."addiction"."of"."all"

Thanks,
Sushanth

if you just handle the string .
you may just replce <.> to <“.”> and append <“> on starts and ends .

public List<String> addQuotes2List2(List<String> list, String delimiter) {
    List<String> tempList = new ArrayList<String>();
    // null check list and delimiter
    String rStr = "/""+delimiter+"/"";
    String rmsg = "";
    for (String s1 : list) {
        rmsg = s1.replace(delimiter, rStr);
        rmsg = "/""+rmsg+"/"";
        tempList.add(rmsg);
    }
    return tempList;
}

regex may no necessary here. (replace and replaceAll made by regex)

If you’re using Java 8, you can use streams to make it more readable.

public List<String> addQuotes2List(List<String> list, String delimiter){
  return list.stream()
    .map(line -> line.split("//"+delimiter))
    .map(this::addQuotes)
    .map(entries -> String.join(delimiter, entries))
    .collect(Collectors.toList());
}

private List<String> addQuotes(String[] entries) {
  return Arrays.stream(entries)
    .map(entry -> String.format("%s", entry))
    .collect(Collectors.toList());
}