I have to repeat code like this many times:
if (!StringUtils.isEmpty(line[9])) {
tbl.setVal(line[9].charAt(0));
}
Can I clean this code up, make it inline, like a conditional operator? I've seen examples with C# but am having trouble finding a similar java example.
Or can I abstract this out into a function? A generic function that could handle multiple types?
My goal here is if the value of line[x]
is empty, I do not want to call setVal