Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe21.iad.POSTED!00000000!not-for-mail From: David Lamb User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Using Enumerated Types as Array Indexes References: <4e4b0d81$0$314$14726298@news.sunsite.dk> In-Reply-To: <4e4b0d81$0$314$14726298@news.sunsite.dk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Lines: 13 Message-ID: NNTP-Posting-Host: 67.193.237.254 X-Complaints-To: abuse@cogeco.net X-Trace: newsfe21.iad 1313584201 67.193.237.254 (Wed, 17 Aug 2011 12:30:01 UTC) NNTP-Posting-Date: Wed, 17 Aug 2011 12:30:01 UTC Date: Wed, 17 Aug 2011 08:29:52 -0400 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7158 On 16/08/2011 8:38 PM, Arne Vajhøj wrote: > On 8/16/2011 10:53 AM, KevinSimonson wrote: >> Java is a pretty handy language in its own right. But in Ada one >> could define arrays to be indexed by enumerated types. Can Java do >> that? If not, why not? > > Java is a simpler language than Ada. In Java array indexes are > int and you have byte/short/int/long types and that is it. Sure -- but if Enums had been in the language from the beginning, then it might have occurred to people that array indexes could be "any type with a method 'int ordinal()'" (with the appropriate caveat about being in range 0..length-1)