This story was originally published on HackerNoon at: https://hackernoon.com/generic-interfaces-when-to-use-them.
In this post, we’ll discuss the use of interfaces with type parameters in a couple of common scenarios.
Check more stories related to programming at: https://hackernoon.com/c/programming.
You can also check exclusive content about #go, #golang, #generic-interfaces, #go-interfaces, #go-tutorial, #go-guide, #go-type-sets, #hackernoon-top-story, and more.
This story was written by: @Go. Learn more about this writer by checking @Go's about page,
and for more stories, please visit hackernoon.com.
As interfaces are types themselves, they too can have type parameters. This idea proves to be surprisingly powerful when it comes to expressing constraints on generic functions and types. In this post, we’ll demonstrate the use of interfaces with type parameters in a couple of common scenarios.