I'm in the process of learning Java 8 and I wanted to know if there was a clean way to re-write the below code more efficiently in Java 8:
public static Map<String, Character> parseOrg(String org) {
Map<String, Character> map = new HashMap<String, Character>();
if (org != null && !org.isEmpty()) {
String modifiedString = trimOrg(org); //private method to substring
if (org.length() == 4) {
doX(); //private method to populate map
} else if (org.length == 3) {
doX(); //private method to populate map
} else if (org.length == 2) {
doX(); //private method to populate map
} else if (org.length == 1) {
doX(); //private method to populate map
}
} else {
LOG.error("Null org provided");
}
return map;
}
Aucun commentaire:
Enregistrer un commentaire