News for hackers. Stuff that matters.
Re:Go generics are not bad by 0xmarcin on Saturday July 09, 2022 @01:07AM (#32031924)
This will work, but will have poor performance due to the way Java generics are implemented. You could use your function with `Integer[]` or `Long[]` arrays but not with `int[]` or `long[]`. `Integer` being a wrapper class around `int` is a regular Java object accessible via reference, hence slow and memory-inefficient.

On the other hand C# offers "real" generics and you can use almost exactly the code that you wrote (generic syntax is slightly different).

There are no comments on this comment yet.