Article View: borland.public.jbuilder.java.language
Article #19245Re: Lack of enumerated types
From: Peter Steele
Date: Fri, 27 Feb 1998 00:00
Date: Fri, 27 Feb 1998 00:00
23 lines
1197 bytes
1197 bytes
>I just use static constants and arrays in an interface.
That's reasonably useful. What I like about enums is that you can create a
set of named integer constants without having to actually worry what their
specific values are:
enum {Sun, Mon, ... Sat} daysOfWeek;
If for some reason you need to change the order, it's this simple:
enum {Mon, Tue, ... Sun} dayOfWeek;
To get this effect I sometimes use this approach:
static final int enumBase = 0;
static final int Mon = enumBase++;
static final int Tue = enumBase++;
...
static final int Sun = enumBase++;
This allows me to reorder the list very easily. Still, it isn't enums...
Technical Details
Message-ID:
<6d6c4f$7l84@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6d233j$37c17@forums.borland.com> <34F5B829.93CC5610@corp.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,ff8748db1a68b7e0 X-Google-Attributes: gidf74b3,public From: "Peter Steele" <peter@ats-forest.com> Subject: Re: Lack of enumerated types Date: 1998/02/27 Message-ID: <6d6c4f$7l84@forums.borland.com> X-Deja-AN: 329140091 References: <6d233j$37c17@forums.borland.com> <34F5B829.93CC5610@corp.borland.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language