Simplify a bit a function

Credit goes to eharris@
master
jvoisin 5 years ago
parent 1bc5729cfb
commit fd1b154a3c
  1. 14
      airsonic-main/src/main/java/org/airsonic/player/util/StringUtil.java

@ -266,17 +266,11 @@ public final class StringUtil {
return null;
}
String[] elements = s.split("_");
switch (elements.length) {
case 0:
return new Locale(s, "", "");
case 1:
return new Locale(elements[0], "", "");
case 2:
return new Locale(elements[0], elements[1], "");
default:
return new Locale(elements[0], elements[1], elements[2]);
List<String> elements = new ArrayList<>(Arrays.asList(s.split("_", 3)));
while (elements.size() < 3) {
elements.add("");
}
return new Locale(elements.get(0), elements.get(1), elements.get(2));
}
/**

Loading…
Cancel
Save