示例#1
0
文件: lists.go 项目: justinsb/gova
func Of(items ...interface{}) collections.Sequence {
	ret := collections.NewArrayList()

	for _, i := range items {
		ret.Add(i)
	}

	return ret
}
示例#2
0
文件: maps.go 项目: justinsb/gova
func Values(m interface{}) collections.Sequence {
	vMap := reflect.ValueOf(m)
	ret := collections.NewArrayList()

	keys := vMap.MapKeys()

	// TODO: ret.Reserve(len(keys))

	for _, vKey := range keys {
		vValue := vMap.MapIndex(vKey)

		ret.Add(vValue.Interface)
	}

	return ret
}