Skip to content
Permalink
0d82ff1dc4
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
26 lines (22 sloc) 581 Bytes
package kb.howtokb.tools;
import java.util.ArrayList;
import java.util.List;
public class StructureConverter {
// Convert a string to a list of integer
public static List<Integer> stringToList(String s) {
List<Integer> listInt = new ArrayList<>();
if (s == null || s.length() == 0)
return listInt;
if (s.contains(";")) {
String[] list = s.split(";");
for (String l : list) {
if (!l.equals("-1"))
listInt.add(Integer.parseInt(l));
}
} else {
if (!s.equals("-1"))
listInt.add(Integer.parseInt(s));
}
return listInt;
}
}