func (l *list) RemoveFirstOccurrence(v interface{}) bool {
	for n := l.first; n != nil; n = n.next {
		for ic, c := range n.values {
			if c == v {
				l.removeElement(n, ic)
				return true
			}
		}
	}
	return false
}
RemoveFirstOccurrence removes the first occurrence of the given value in the list and returns true, or false if there is no such element
package unrolledlinkedlist
import (
	"errors"
	List "github.com/zimmski/container/list"
)
type node struct {
	next     *node          
	previous *node          
	values   []interface{}  
}
type iterator struct {
	current *node  
	i       int    
}
func (iter *iterator) Next() List.Iterator {
	iter.i++
	if iter.current != nil && iter.i >= len(iter.current.values) {
		iter.i = 0
		iter.current = iter.current.next
	}
	if iter.current == nil {
		return nil
	}
	return iter
}
func (iter *iterator) Previous() List.Iterator {
	iter.i--
	if iter.current != nil && iter.i < 0 {
		iter.current = iter.current.previous
		if iter.current != nil {
			iter.i = len(iter.current.values) - 1
		}
	}
	if iter.current == nil {
		return nil
	}
	return iter
}
func (iter *iterator) Get() interface{} {
	return iter.current.values[iter.i]
}
func (iter *iterator) Set(v interface{}) {
	iter.current.values[iter.i] = v
}
type list struct {
	first       *node  
	last        *node  
	maxElements int    
	len         int    
}
func New(maxElements int) *list {
	if maxElements < 1 {
		panic("maxElements must be at least 1")
	}
	l := new(list)
	l.Clear()
	l.maxElements = maxElements
	return l
}
func (l *list) Clear() {
	i := l.first
	for i != nil {
		j := i.next
		i.next = nil
		i.previous = nil
		i.values = nil
		i = j
	}
	l.first = nil
	l.last = nil
	l.len = 0
}
func (l *list) Len() int {
	return l.len
}
func (l *list) Empty() bool {
	return l.len == 0
}
func (l *list) insertElement(v interface{}, c *node, ic int) {
	if c == nil || ic == 0 || len(c.values) == 0 {  
		n := l.insertNode(c, false)
		n.values = append(n.values, v)
	} else if len(c.values) == ic {  
		n := c
		if len(n.values) == cap(n.values) {
			n = l.insertNode(c, true)
			if l.maxElements > 3 {
				ic = (len(c.values) + 1) / 2
				n.values = append(n.values, c.values[ic:len(c.values)]...)
				c.values = c.values[:ic]
			}
		}
		n.values = append(n.values, v)
	} else {  
		n := l.insertNode(c, true)
		n.values = append(n.values, c.values[ic:len(c.values)]...)
		c.values[ic] = v
		c.values = c.values[:ic+1]
	}
	l.len++
}
func (l *list) removeElement(c *node, ic int) interface{} {
	v := c.values[ic]
	for ; ic < len(c.values)-1; ic++ {
		c.values[ic] = c.values[ic+1]
	}
	c.values = c.values[:len(c.values)-1]
	l.len--
	if len(c.values) == 0 {
		l.removeNode(c)
	} else if n := c.next; l.maxElements > 3 && n != nil && len(c.values) < l.maxElements/2 {
		if len(n.values)-2 < l.maxElements/2 {  
			for _, v := range n.values {
				c.values = append(c.values, v)
			}
			l.removeNode(n)
		} else {  
			c.values = append(c.values, n.values[0], n.values[1])
			for ic = 2; ic < len(n.values); ic++ {
				n.values[ic-2] = n.values[ic]
			}
			n.values = n.values[:len(n.values)-2]
		}
	}
	return v
}
func (l *list) newNode() *node {
	return &node{
		values: make([]interface{}, 0, l.maxElements),
	}
}
func (l *list) getNode(i int) (*node, int) {
	for c := l.first; c != nil; c = c.next {
		if i < len(c.values) {
			return c, i
		}
		i -= len(c.values)
	}
	return nil, -1
}
func (l *list) insertNode(p *node, after bool) *node {
	n := l.newNode()
	if l.len == 0 {
		l.first = n
		l.last = n
	} else if after {
		n.next = p.next
		if p.next != nil {
			p.next.previous = n
		}
		p.next = n
		n.previous = p
		if p == l.last {
			l.last = n
		}
	} else {
		if p == l.first {
			l.first = n
		} else {
			if p.previous != nil {
				p.previous.next = n
				n.previous = p.previous
			}
		}
		n.next = p
		p.previous = n
	}
	return n
}
func (l *list) removeNode(c *node) *node {
	if c == l.first {
		l.first = c.next
		if c.next != nil {
			c.next.previous = nil
		}
		if c == l.last {
			l.last = nil
		}
	} else {
		if c.previous != nil {
			c.previous.next = c.next
			if c.next != nil {
				c.next.previous = c.previous
			} else if c == l.last {
				l.last = c.previous
			}
		}
	}
	c.next = nil
	c.previous = nil
	c.values = nil
	return c
}
func (l *list) newIterator(current *node, i int) *iterator {
	return &iterator{
		i:       i,
		current: current,
	}
}
func (l *list) Chan(n int) <-chan interface{} {
	ch := make(chan interface{})
	go func() {
		for iter := l.Iter(); iter != nil; iter = iter.Next() {
			ch <- iter.Get()
		}
		close(ch)
	}()
	return ch
}
func (l *list) ChanBack(n int) <-chan interface{} {
	ch := make(chan interface{})
	go func() {
		for iter := l.IterBack(); iter != nil; iter = iter.Previous() {
			ch <- iter.Get()
		}
		close(ch)
	}()
	return ch
}
func (l *list) Iter() List.Iterator {
	if l.len == 0 {
		return nil
	}
	return l.newIterator(l.first, 0)
}
func (l *list) IterBack() List.Iterator {
	if l.len == 0 {
		return nil
	}
	return l.newIterator(l.last, len(l.last.values)-1)
}
func (l *list) First() (interface{}, bool) {
	if l.len == 0 {
		return nil, false
	}
	return l.first.values[0], true
}
func (l *list) Last() (interface{}, bool) {
	if l.len == 0 {
		return nil, false
	}
	return l.last.values[len(l.last.values)-1], true
}
func (l *list) Get(i int) (interface{}, error) {
	if i > -1 && i < l.len {
		for c := l.first; c != nil; c = c.next {
			if i < len(c.values) {
				return c.values[i], nil
			}
			i -= len(c.values)
		}
	}
	return nil, errors.New("index bounds out of range")
}
func (l *list) GetFunc(m func(v interface{}) bool) (interface{}, bool) {
	for iter := l.Iter(); iter != nil; iter = iter.Next() {
		if m(iter.Get()) {
			return iter.Get(), true
		}
	}
	return nil, false
}
func (l *list) Set(i int, v interface{}) error {
	if i > -1 && i < l.len {
		for c := l.first; c != nil; c = c.next {
			if i < len(c.values) {
				c.values[i] = v
				return nil
			}
			i -= len(c.values)
		}
	}
	return errors.New("index bounds out of range")
}
func (l *list) SetFunc(m func(v interface{}) bool, v interface{}) bool {
	for iter := l.Iter(); iter != nil; iter = iter.Next() {
		if m(iter.Get()) {
			iter.Set(v)
			return true
		}
	}
	return false
}
func (l *list) Swap(i, j int) {
	ni, ici := l.getNode(i)
	nj, icj := l.getNode(j)
	if ni != nil && nj != nil {
		ni.values[ici], nj.values[icj] = nj.values[icj], ni.values[ici]
	}
}
func (l *list) Contains(v interface{}) bool {
	_, ok := l.IndexOf(v)
	return ok
}
func (l *list) IndexOf(v interface{}) (int, bool) {
	i := 0
	for n := l.first; n != nil; n = n.next {
		for _, c := range n.values {
			if c == v {
				return i, true
			}
			i++
		}
	}
	return -1, false
}
func (l *list) LastIndexOf(v interface{}) (int, bool) {
	i := l.len - 1
	for n := l.last; n != nil; n = n.previous {
		for j := len(n.values) - 1; j > -1; j-- {
			if n.values[j] == v {
				return i, true
			}
			i--
		}
	}
	return -1, false
}
func (l *list) Copy() List.List {
	n := New(l.maxElements)
	for iter := l.Iter(); iter != nil; iter = iter.Next() {
		n.Push(iter.Get())
	}
	return n
}
func (l *list) Slice() []interface{} {
	a := make([]interface{}, l.len)
	j := 0
	for iter := l.Iter(); iter != nil; iter = iter.Next() {
		a[j] = iter.Get()
		j++
	}
	return a
}
func (l *list) Insert(i int, v interface{}) error {
	if i < 0 || i > l.len {
		return errors.New("index bounds out of range")
	}
	if i != l.len {
		c, ic := l.getNode(i)
		l.insertElement(v, c, ic)
	} else {  
		l.Push(v)
	}
	return nil
}
func (l *list) Remove(i int) (interface{}, error) {
	if i < 0 || i >= l.len {
		return nil, errors.New("index bounds out of range")
	}
	return l.removeElement(l.getNode(i)), nil
}