Files
go-easy-utils/mapUtil/extract_values_example_test.go

18 lines
313 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package mapUtil
import (
"fmt"
"sort"
)
func ExampleExtractValues() {
m := map[string]int{"apple": 5, "banana": 3, "orange": 7}
values := ExtractValues(m)
// 对结果排序以确保输出一致map 迭代顺序随机)
sort.Ints(values)
fmt.Println("Values:", values)
// Output: Values: [3 5 7]
}