Top "Enums" questions

A data type consisting of a set of named values called elements, members or enumerators of the type.

Mocking Java enum to add a value to test fail case

I have an enum switch more or less like this: public static enum MyEnum {A, B} public int foo(MyEnum …

java unit-testing enums mocking code-coverage
C# vs Java Enum (for those new to C#)

I've been programming in Java for a while and just got thrown onto a project that's written entirely in C#. …

c# java enums language-comparisons
Is there a way to check if int is legal enum in C#?

I've read a few SO posts and it seems most basic operation is missing. public enum LoggingLevel { Off = 0, Error = 1, Warning = 2, …

c# enums
How to iterate over values of an Enum having flags?

If I have a variable holding a flags enum, can I somehow iterate over the single-bit values in that specific …

c# enums enum-flags
How can I reference my Java Enum without specifying its type

I have a class that defines its own enum like this: public class Test { enum MyEnum{E1, E2}; public static …

java enums
How to get all enum values as an array

I have the following enum. enum EstimateItemStatus: Printable { case Pending case OnHold case Done var description: String { switch self { case .…

ios arrays swift enums
Should I use #define, enum or const?

In a C++ project I'm working on, I have a flag kind of value which can have four values. Those …

c++ enums bit-manipulation c-preprocessor
enum implementation inside interface - Java

I have a question about putting a Java enum in the interface. To make it clearer, please see the following …

java interface enums enumeration
Switch over type in java

Before I start, I know there are a bunch of answers to this question that suggest alternate approaches. I'm looking …

java types enums switch-statement instanceof
Jackson databind enum case insensitive

How can I deserialize JSON string that contains enum values that are case insensitive? (using Jackson Databind) The JSON string: [{"…

java json serialization enums jackson