Skip to main content
11 events
when toggle format what by license comment
Nov 24, 2023 at 10:31 vote accept Joe
Jul 7, 2020 at 16:01 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Mar 9, 2020 at 16:01 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Feb 8, 2020 at 15:35 answer added siegi timeline score: 2
Feb 4, 2020 at 11:32 comment added Filip Milovanović I don't think that's a realistic issue - they will be right next to each other in code, the implementation isn't really hidden, and (if I'm not mistaken) the IDE should present the user with both. What you have here is less of a traditional enum (enumerated constants), and more of a proper class that happens to provide a way to get a finite number of predefined instances. In a different language, you'd model that by making the constructors private, and providing a number of static methods (or properties) that supply the predefined values. This is the same thing, just in a Java flavor.
Feb 4, 2020 at 11:26 comment added Joe I was thinking having overloaded constructors too, but I'd be tempted to say they may have the same issue that #2 has that they could be "forgotten"... although to be fair, there's only so much you can do at some point
Feb 4, 2020 at 11:24 comment added Filip Milovanović Why not just overload the constructor with another version that takes the boolean as well? See this.
Feb 4, 2020 at 11:19 comment added Ewan cant you have a default optional parameter on the constructor, or overloaded constructors?
Feb 4, 2020 at 11:16 history edited Joe
removed c# tag
Feb 4, 2020 at 11:06 comment added Ewan an enum with constructors and properties?
Feb 4, 2020 at 10:35 history asked Joe CC BY-SA 4.0