Parameterizing a common template
There are two primary ways I can think of to change this:


Iterate over an array

String[] fieldNames = new String[]{ "empName", "empNum", "empSalary" };
for (String field : fieldNames) {
    if (collectValue(field, record) &lt; 0) {
         return false;
    }
}

Boolean short-circuiting

boolean returnFalse = collectValue("empName", record) &lt; 0 || collectValue("empNum", record) &lt; 0 || collectValue("empSalary", record) &lt; 0;
if (returnFalse) {
    return false;
}



I would personally recommend the first version, as the second version creates a long statement and is a bit more difficult to both read and debug.