Re: array of lists



Wesley Hall wrote:

Seems there is lots of discussion on the creation of generic arrays in
Java, but the bottom line seems to be that you cant do it in any
reasonable way.

Just don't use them. With generics there is little use for arrays of reference types. Just use a List.

If you just want to clear the compiler warning, put the following
annotation on the method that does the add..

@SuppressWarnings({"unchecked"})

That is a measure of last resort. Not something to be thrown around just to make the compiler shut up. If the compiler is making a noise, there is probably a good reason.

Tom Hawtin
.



Relevant Pages

  • Re: Anonymous Method/Properties etc with
    ... The big reason is because of the way that generics are handled at run ... The CLR is actually aware of them as generics. ... > type parameters by default because the compiler will complain about ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Free FAT16 Filesystem
    ... being an honourable reason. ... Dave, I made every effort 3 weeks ago to have you understand that if you ... >>Murray did not mention Keil in his correspondence to you. ... >>both your compiler AND under Keil's, ...
    (comp.arch.embedded)
  • Re: Compiler Error CS0702
    ... So I see no reason for the spec to ... I have also pointed out that the specification does specifically disallow the use of System.Enum as a constraint, contrary to your statements that it doesn't. ... As is the case for any value type, assigning an instance of the value type to a reference type variable requires boxing. ... generics treat value type parameters differently from reference type parameters. ...
    (microsoft.public.dotnet.languages.csharp)
  • compiler and metadata, request opinions...
    ... a lot of the upper/middle compiler machinery is still lacking (such as ... embed the metadata directly into the object modules (the reason being that ... request for a particular piece of information is embedded in a symbol (sort ... it will be loaded into an in-memory version of the database. ...
    (comp.compilers)
  • misc: compiler and metadata...
    ... a lot of the upper/middle compiler machinery is still lacking (such as ... embed the metadata directly into the object modules (the reason being that ... request for a particular piece of information is embedded in a symbol (sort ... it will be loaded into an in-memory version of the database. ...
    (comp.lang.misc)