More succinct return statements

This commit is contained in:
Owen Stephens 2017-11-14 17:40:07 +00:00
parent 25dd347123
commit 7ba110e31a

View File

@ -76,16 +76,16 @@ abstract public class ExpressionStringComparisonRowFilter implements RowFilter {
Object[] a = (Object[]) value; Object[] a = (Object[]) value;
for (Object v : a) { for (Object v : a) {
if (checkValue(v instanceof String ? ((String) v) : v.toString())) { if (checkValue(v instanceof String ? ((String) v) : v.toString())) {
return (invert) ? false : true; return !invert;
} }
} }
} else if (value instanceof Collection<?>) { } else if (value instanceof Collection<?>) {
for (Object v : ExpressionUtils.toObjectCollection(value)) { for (Object v : ExpressionUtils.toObjectCollection(value)) {
if (checkValue(v.toString())) { if (checkValue(v.toString())) {
return (invert) ? false : true; return !invert;
} }
} }
return (invert) ? true : false; return invert;
} else if (value instanceof JSONArray) { } else if (value instanceof JSONArray) {
JSONArray a = (JSONArray) value; JSONArray a = (JSONArray) value;
int l = a.length(); int l = a.length();
@ -93,20 +93,20 @@ abstract public class ExpressionStringComparisonRowFilter implements RowFilter {
for (int i = 0; i < l; i++) { for (int i = 0; i < l; i++) {
try { try {
if (checkValue(a.get(i).toString())) { if (checkValue(a.get(i).toString())) {
return (invert) ? false : true; return !invert;
} }
} catch (JSONException e) { } catch (JSONException e) {
// ignore // ignore
} }
} }
return (invert) ? true : false; return invert;
} else { } else {
if (checkValue(value instanceof String ? ((String) value) : value.toString())) { if (checkValue(value instanceof String ? ((String) value) : value.toString())) {
return (invert) ? false : true; return !invert;
} }
} }
} }
return (invert) ? true : false; return invert;
} }
abstract protected boolean checkValue(String s); abstract protected boolean checkValue(String s);