3 ms·
As long as you are able to take the same code path for all empty lists, you can do something like if (xyz instanceof List) { if (xyz.isEmpty()) { ... }
by bunderbunder 8y ago
As long as you are able to take the same code path for all empty lists, you can do something like
if (xyz instanceof List) {
if (xyz.isEmpty()) { ... }
else if (xyz.get(0) instanceof String) { ... }
else if (xyz.get(0) instanceof Integer) { ... }
}
Which, I admit, is a gross hack.