func (c *Collection) All() []interface{} {
	c.lock.RLock()
	defer c.lock.RUnlock()
	values := make([]interface{}, len(c.items))
	i := 0
	for _, v := range c.items {
		values[i] = v
		i++
	}
	return values
}
All returns collection values.
package collection
import "sync"
type Item struct {
	Key   interface{}
	Value interface{}
}
type Callback func(item interface{}, key interface{}) interface{}
type Collection struct {
	lock  *sync.RWMutex
	items map[interface{}]interface{}
}
func New() *Collection {
	return &Collection{
		lock:  new(sync.RWMutex),
		items: make(map[interface{}]interface{}),
	}
}
func NewWithItems(items map[interface{}]interface{}) *Collection {
	return &Collection{
		lock:  new(sync.RWMutex),
		items: items,
	}
}
func (c *Collection) Set(key interface{}, value interface{}) {
	c.lock.Lock()
	defer c.lock.Unlock()
	c.items[key] = value
}
func (c *Collection) Get(key interface{}) interface{} {
	c.lock.RLock()
	defer c.lock.RUnlock()
	return c.items[key]
}
func (c *Collection) Has(key interface{}) bool {
	c.lock.RLock()
	defer c.lock.RUnlock()
	_, exists := c.items[key]
	return exists
}
func (c *Collection) Delete(key interface{}) {
	c.lock.RLock()
	defer c.lock.RUnlock()
	delete(c.items, key)
}
func (c *Collection) Count() int {
	c.lock.RLock()
	defer c.lock.RUnlock()
	return len(c.items)
}
func (c *Collection) Foreach() <-chan Item {
	ch := make(chan Item)
	go func() {
		c.lock.RLock()
		defer c.lock.RUnlock()
		for key, value := range c.items {
			ch <- Item{key, value}
		}
		close(ch)
	}()
	return ch
}
func (c *Collection) Map(callback Callback) *Collection {
	result := New()
	for item := range c.Foreach() {
		result.Set(item.Key, callback(item.Value, item.Key))
	}
	return result
}
func (c *Collection) Transform(callback Callback) {
	c.lock.RLock()
	defer c.lock.RUnlock()
	for key, value := range c.items {
		c.items[key] = callback(value, key)
	}
}