Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed (Author was flagged for spam)

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Creating/modifying class fields at runtime without having to instantiate
Post Body

Sorry if there's something obvious I missed here. For example, let's say I'm making a card game and want to make store a bunch of constants of type Card in a class Cards. After all, there are only a limited number of kinds of playing cards so it makes sense to store them all as reference values. This might be useful if I had a method Deck.hasCard(Card c), for example. If I want to see if a Deck has a five of spades, for example, I shouldn't have to create a new Card() just to do that. However, I don't see a way to do that without either manually specifying every kind of card possible, (the two ways I know how to do this are to either use an enum, or maybe make a regular class then include them as part of a data structure like ArrayList<>) or including a constructor to iterate over the suits and values which doesn't make sense for what is basically an enum. Please let me know if I'm wrong about or missing something.

Author
Account Strength
0%
Account Age
6 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,962
Link Karma
929
Comment Karma
1,015
Profile updated: 3 weeks ago
Posts updated: 2 weeks ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago