I wrote a function which takes in input a list of strings that is splitted by comma. Then each generated string is trimmed.Example: INPUT:    [[Cat, Dog, Snake]]OUTPUT:   Cat Dog SnakeIn particular, I'm interested in removing parenthesis and commas.This is the code I wrote, but I think it is awful and not so efficient because I use so many String and LinkedList variables.private List<String> splitListOfString(LinkedList<String> list){String mylist = list.toString(); //is made by parenthesis, I do not wantmylist = mylist.substring(2);  //delete the first 2mylist = mylist.substring(0, mylist.length() - 2); //delete the last 2List<String> thelist = Arrays.asList(mylist.split(,));List<String> thelist2 = new LinkedList<String>();for (String string : thelist) {    thelist2.add(string.trim());}    return thelist2;}The line of code involving the trim function is compulsory to avoid something like  string, that is undesirable. But I do not think that this is the best way to write this code.How would you improve this?
Splitting strings in Java
java;strings