I have a LinkedHashMap of pages, and I have an array of PageIDs. I want to write a method that returns an array of the pages whos id is found in PageIDs
the problem is that page is a generic class.
when I write Page<byte[]>[] pagesToReturn = new Page<byte[]>[pageIds.length]; I ofcourse get the error "Cannot create a generic array of Page".
When I try to create an array and then cast it, as such: Page<byte[]>[] pagesToReturn = (Page<byte[]>[]) new Page[pageIds.length]; I get a warning "Type safety: Unchecked cast from Page[] to Page[]".
I know this is somewhat of a delicate issue, but I have to adhere to the signature of the method public Page<byte[]>[] getPages(Long[] pageIds), it has to return an array of pages whos generic type is array of bytes.
Is there a workaround to this issue that does not include a warning supression?