Bob Bob - 1 year ago 72
Java Question

How can I check if an array of unknown type is empty?

Say I have an Object which I know is an array. How can I find out if it contains any elements?

public void myMethod (Object o) {
if (o.getClass().isArray()) {
// how can I check if the array contains any elements?

Answer Source


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download