Why doesn't Android use more enums?

前端 未结 3 1583
抹茶落季
抹茶落季 2020-12-02 09:27

I\'ve started to really like using C# and Java enums in my code for several reasons:

  • They are much more type-safe than integers, strings, or sets of boolean fl
3条回答
  •  甜味超标
    2020-12-02 10:02

    A colleague of mine performed a small test regarding this situation. He auto generated a class and an enum with the same amount of "enums". I believe he generated 30000 entries.

    The results were:

    • .class for the class was roughly 1200KB
    • .class for the enum was roughly 800KB

    Hope this helps someone.

提交回复
热议问题