About 50 results
Open links in new tab
  1. Understanding Enums in Java - Stack Overflow

    Sep 14, 2009 · What are java enums? How do they work? Where could I used them and how? Can I do without using enums in an app or are they so powerful that Its better to use them than ignore them?

  2. What are enums and why are they useful? - Stack Overflow

    Jan 17, 2011 · 2 The enum based singleton a modern look at an old problem This approach implements the singleton by taking advantage of Java's guarantee that any enum value is instantiated only once …

  3. Why can't I use foreach on Java Enumeration? - Stack Overflow

    Enumeration was replaced by Iterator in Java 1.2 in 1998 and is retained for legacy support. The real question is why you want to use it. Possibly because you use a library which forces you to do so?

  4. What's the use of "enum" in Java? - Stack Overflow

    Mar 24, 2012 · Java programming language enum types are much more powerful than their counterparts in other languages. The enum declaration defines a class (called an enum type).

  5. How to get an enum value from a string value in Java

    6 java.lang.Enum defines several useful methods, which is available to all enumeration types in Java: You can use the name() method to get the name of any Enum constants. The string literal used to …

  6. In java, what does Enumeration<?> mean? - Stack Overflow

    Oct 13, 2011 · The <?> syntax is java's way to specifying that the generic type is "unbounded" - ie it can be "anything". Enumeration<?> is an Enumeration with an "unbounded type" - you can assign an …

  7. lambda - Iterate an Enumeration in Java 8 - Stack Overflow

    Is it possible to iterate an Enumeration by using Lambda Expression? What will be the Lambda representation of the following code snippet: Enumeration&lt;NetworkInterface&gt; nets = …

  8. Comparing Java enum members: == or equals()? - Stack Overflow

    I know that Java enums are compiled to classes with private constructors and a bunch of public static members. When comparing two members of a given enum, I've always used .equals(), e.g. public

  9. How do I turn a Java Enumeration into a Stream? - Stack Overflow

    The question linked is asking how to turn an Enumeration (Java 1.0) into an Iterator (Java 1.2). I'm asking how to turn it into a Stream (Java 1.8). While it does appear that the the last answer in the …

  10. java - Best way to create enum of strings? - Stack Overflow

    Oct 20, 2010 · What is the best way to have a enum type represent a set of strings? I tried this: enum Strings{ STRING_ONE("ONE"), STRING_TWO("TWO") } How can I then use them as Strings?