liveBook · Manning

Generic interface

A generic interface is an interface declaration parameterized by one or more type parameters, defining a contract that can be specialized for particular types.

How 2 Manning books explain it

Go in Action, Second Edition

A generic interface is an interface parameterized by one or more type parameters whose implementations must match the resulting type-specific contract.

How it is used
Uses generic interfaces to express reusable, type-specific collection contracts.
How deep it goes
Implements collection and indexed-list methods, then examines type assertions and constraint method sets.
Examples
Demonstrates a generic List and LinkedList, an integer list, and a list-reversal function.
What you can do after
Build it from scratch by defining a parameterized interface and implementing its methods on a generic data structure.

Read how Go in Action, Second Edition explains generic interface →

Fabulous Adventures in Data Structures and Algorithms

A generic interface is an interface parameterized by one or more type parameters.

How it is used
Uses parameterized contracts to raise randomness and type-specific operations above concrete implementations.
How deep it goes
Builds distribution and visitor interfaces with implementations, then traces overload resolution and dispatch; it stops short of broader interface design.
Examples
Uses Random-backed discrete uniform distributions and expression-tree visitors returning a generic result type.
What you can do after
Build it from scratch as a C# contract, extend it through inheritance, and diagnose visitor dispatch when static types hide subtype-specific methods.

Read how Fabulous Adventures in Data Structures and Algorithms explains generic interface →

Also covered in

Related concepts

Questions about generic interface

What is generic interface?

A generic interface is an interface declaration parameterized by one or more type parameters, defining a contract that can be specialized for particular types.

Which Manning books explain generic interface?

Go in Action, Second Edition and Fabulous Adventures in Data Structures and Algorithms.

What kinds of generic interface are there?

Kinds of generic interface include covariant generic interface.

What is generic interface a kind of?

Generic interface is a kind of interface. An interface is a contract or boundary that specifies the operations, members, or data shape a type or component exposes, without prescribing its complete implementation.

What are the parts of generic interface?

Generic interface includes generics.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.