Source file tour/generics/list.go
1 package main 2 3 // List represents a singly-linked list that holds 4 // values of any type. 5 type List[T any] struct { 6 next *List[T] 7 val T 8 } 9 10 func main() { 11 } 12
1 package main 2 3 // List represents a singly-linked list that holds 4 // values of any type. 5 type List[T any] struct { 6 next *List[T] 7 val T 8 } 9 10 func main() { 11 } 12