I
Ian
Hi,
I've got a question related to typing when using the new generics.
In the following, is there any way to specify the type of collection if
its known by the caller? Lets say the type of the objects to be return
is "Action".
static Collection getInstances(Collection<String> classNames,
Object ... args)
{
Collection instances = new ArrayList();
for (String className : classNames)
{
Object obj = getInstance(className, args);
instances.add(obj);
}
return instances;
}
I've got a question related to typing when using the new generics.
In the following, is there any way to specify the type of collection if
its known by the caller? Lets say the type of the objects to be return
is "Action".
static Collection getInstances(Collection<String> classNames,
Object ... args)
{
Collection instances = new ArrayList();
for (String className : classNames)
{
Object obj = getInstance(className, args);
instances.add(obj);
}
return instances;
}