Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #8976

Re: Cannot create a generic array of <type>

From Warren Tang <nospam@tangcs.com>
Newsgroups comp.lang.java.programmer
Subject Re: Cannot create a generic array of <type>
Date 2011-10-19 13:22 +0800
Organization Aioe.org NNTP Server
Message-ID <j7lmrb$tt1$1@speranza.aioe.org> (permalink)
References <j7lic6$lob$1@speranza.aioe.org>

Show all headers | View raw


On 10/19/2011 12:06 PM, Warren Tang wrote:
> Hi,everybody
> 
> The following code:
> 
>    ArrayList<Integer>[] indexedValues = new ArrayList<Integer>[5];
> 
> generates an error:
> 
>    Cannot create a generic array of ArrayList<Integer>
> 
> Could someone explain this to me?
> 
> Regards,
> Warren Tang

Finally found a good article explaining this. It's about Type Erasure:
http://code.stephenmorley.org/articles/java-generics-type-erasure/

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Cannot create a generic array of <type> Warren Tang <nospam@tangcs.com> - 2011-10-19 12:06 +0800
  Re: Cannot create a generic array of <type> Warren Tang <nospam@tangcs.com> - 2011-10-19 13:22 +0800
  Re: Cannot create a generic array of <type> Lew <lewbloch@gmail.com> - 2011-10-18 23:28 -0700
    Re: Cannot create a generic array of <type> Warren Tang <nospam@tangcs.com> - 2011-10-19 18:11 +0800
      Re: Cannot create a generic array of <type> markspace <-@.> - 2011-10-19 04:50 -0700
        Re: Cannot create a generic array of <type> Warren Tang <nospam@tangcs.com> - 2011-10-20 00:43 +0800
          Re: Cannot create a generic array of <type> markspace <-@.> - 2011-10-19 12:21 -0700
            Re: Cannot create a generic array of <type> Warren Tang <nospam@tangcs.com> - 2011-10-21 11:05 +0800
      Re: Cannot create a generic array of <type> Lew <lewbloch@gmail.com> - 2011-10-19 10:00 -0700

csiph-web