In Java, how to iterate on the constants of an interface?

前端 未结 6 1242
心在旅途
心在旅途 2021-02-07 12:51

in an interface, I store constants in this way (I\'d like to know what you think of this practice). This is just a dummy example.

interface HttpConstants {
    /         


        
6条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 13:34

    Well usually when i have something like that i make a Map in the interface that has the keys - constant names with values constant - values.

    And that's how i can iterate over them.

提交回复
热议问题