When should I use primitives instead of wrapping objects?

后端 未结 5 2192
逝去的感伤
逝去的感伤 2020-12-14 09:52

Actually here is a similar topic with little practical value. As far as I understand, primitives perform better and should be used everywhere except for the cases where Obje

5条回答
  •  余生分开走
    2020-12-14 10:32

    I would say you should be worried about using primitives over wrappers only when you profile your application and see that the autoboxing is a performance or memory issue. In my experience memory becomes an issue before CPU cycles when talking about primitives vs wrapping objects.

提交回复
热议问题