List

List is a collection with index. It implements IIndexableCollection.

Example

Create a List

package main

import (
	"github.com/KafkaWannaFly/generic-collections/list"
)

func main() {
	// You can create a new list from a slice
	integerList := list.From(1, 2, 3, 4, 5)

	// You also can chaining the Add method
	chainedList := list.New[int]()
	chainedList.Add(1).Add(2).Add(3).Add(4).Add(5)

	// You can add all elements from chainedList to integerList
	integerList.AddAll(chainedList)
}

Get and Set

Map and Sum

Grouping

Filtering

Slice a List

Last updated