Java: Check if enum contains a given string?

后端 未结 29 1576
一个人的身影
一个人的身影 2020-12-02 03:59

Here\'s my problem - I\'m looking for (if it even exists) the enum equivalent of ArrayList.contains();.

Here\'s a sample of my code problem:

<         


        
29条回答
  •  佛祖请我去吃肉
    2020-12-02 04:42

    It is an enum, those are constant values so if its in a switch statement its just doing something like this:

    case: val1
    case: val2
    

    Also why would you need to know what is declared as a constant?

提交回复
热议问题