I am starting to learn Java and I’d like to try to test out a few Java features by writing a simple program that will build an array of a deck of cards and will print out a list of all the cards. When I started doing this I was unsure whether it is more efficient to use numbers to represent the cards suits and ranks or to use enums. I’d like to know which is better in terms of efficiency, readability and convention? Which is better for iteration? Thanks.
Share
Readability: Enums
Convention: Enums
Efficiency: You shouldn’t care until you know you have a problem. It is very unlikely that you will ever encounter a performance problem due to the use of Enums.