I have a parser method which will fill a user defined collection type upon completion. I am trying to abstract this class in my abstract parser class.
Here is the code
protected List<Collection> parseData(List<Data> data, Class<Collection> collectionType)
{
List<Collection> parsedData = new ArrayList<collectionType>();
//Parse data
return parsedData
}
However I keep getting the following errors on the list instantiation line:
collectionType cannot be resolved to a type,
ArrayList cannot be resolved to a type
This is my first time trying something like this and I am not sure what is wrong. Any help would be appreciated.
You need to use generic method. Something like this.
C# :
JAVA :