I have a method that returns the reference to the array of object, and I need to get the count of the items in the array. Is it possible ?
The snippt of the method is as follow:
public Object getAllDChannelId()
{
Object[] items = getAllItems();
Object[] ids = new Object[items.length];
for (int i = 0; i < items.length; i++)
ids[i] = items[i].getId();
return ids;
}
Now I am trying to get the count of items returend through getAllDChannelId(). How to get that ?
edit: I don’t want(actually can not) change the signature of the method getAllDChannelId().
enter code hereChange the return type of the function
At the calling environment
Updated
If for some cases you just need reference then do this when you need array of objects