Code duplication caused by primitive types: How to avoid insanity?

前端 未结 8 460
温柔的废话
温柔的废话 2020-12-13 00:44

In one of my Java projects I am plagued by code repetition due to the way Java handles (not) primitives. After having to manually copy the same change to four different loca

8条回答
  •  旧时难觅i
    2020-12-13 01:05

    I tend to use a "super type" like long or double if I still want a primitive. The performance is usually very close and it avoids creating lots of variations. BTW: registers in a 64-bit JVM will all be 64-bit anyway.

提交回复
热议问题