Last Updated: May 22, 2026
Generic functions are useful, but a lot of the value of generics shows up when you put type parameters on a struct. A Stack that works for orders and products, a Set of any comparable type, a LinkedList whose nodes hold whatever you want. This lesson covers how to declare generic struct types, how to write methods on them, the extra constraints that map keys need, and a small set of rules that come up when first using a Stack[T].