3 ms·
From this description, I'm getting the impression that Go's interfaces are not as much like Java interfaces as I had assumed. Never the less, I find that gener
by AnIdiotOnTheNet 9y ago
From this description, I'm getting the impression that Go's interfaces are not as much like Java interfaces as I had assumed.
Never the less, I find that generics usually are just an over-engineered solution to any given problem.
- weberc2 9y agoThe primary differences (I think) are that everything in Java is already a pointer, so there isn't an extra alloc to make an interface. The same is true in Go if your comparables are all pointers. Probably the more significant difference is that Java has a JIT compiler, which may be able to inline all of those calls to Compare(). This is largely why Go's `sort` package abstracts over the collection, not over the element.