Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Go
/
Generics
A Stack[T] method needs to transform values into a new type U. Which declaration is valid…
from Generics
Go 1.27
intermediate
1 min
A Stack[T] method needs to transform values into a new type U. Which declaration is valid Go?
A standalone function MapStack[T, U any](Stack[T], func(T) U) Stack[U]
A method func (s Stack[T]) Map[U any](func(T) U) Stack[U]
A method that declares U after its return type
Check
Ask AI about this kata
Report an error
previous kata
In a constraint, what is the difference between int and ~int?
Quiz
next kata
What does this program print?
Predict the output
A new version is available
Reload