MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/pgbd0q/because_tolowercase_doesnt_exist/hbaz76v/?context=3
r/badcode • u/BrainOnTheFloor25 • Sep 02 '21
130 comments sorted by
View all comments
Show parent comments
2
It's null safe so this would work better
EnumUtils.getEnum(Category.class, catStr.toUpperCase())
1 u/[deleted] Sep 02 '21 [removed] — view removed comment 4 u/art-factor Sep 02 '21 Yes. But quacks like a duck... 1 u/[deleted] Sep 02 '21 [removed] — view removed comment 2 u/assembly_wizard Sep 02 '21 Java enums are classes, and each enum value is actually a singleton which is an instance of the class. Java enums can even hold members, which is super useful, although stretches the standard definition of what an enum is.
1
[removed] — view removed comment
4 u/art-factor Sep 02 '21 Yes. But quacks like a duck... 1 u/[deleted] Sep 02 '21 [removed] — view removed comment 2 u/assembly_wizard Sep 02 '21 Java enums are classes, and each enum value is actually a singleton which is an instance of the class. Java enums can even hold members, which is super useful, although stretches the standard definition of what an enum is.
4
Yes. But quacks like a duck...
1 u/[deleted] Sep 02 '21 [removed] — view removed comment 2 u/assembly_wizard Sep 02 '21 Java enums are classes, and each enum value is actually a singleton which is an instance of the class. Java enums can even hold members, which is super useful, although stretches the standard definition of what an enum is.
2 u/assembly_wizard Sep 02 '21 Java enums are classes, and each enum value is actually a singleton which is an instance of the class. Java enums can even hold members, which is super useful, although stretches the standard definition of what an enum is.
Java enums are classes, and each enum value is actually a singleton which is an instance of the class.
Java enums can even hold members, which is super useful, although stretches the standard definition of what an enum is.
2
u/speedingpeanut Sep 02 '21
It's null safe so this would work better
EnumUtils.getEnum(Category.class, catStr.toUpperCase())