| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package main |
| 6 |
|
| 7 |
import ( |
| 8 |
"cmp" |
| 9 |
|
| 10 |
sll "github.com/emirpasic/gods/v2/lists/singlylinkedlist" |
| 11 |
) |
| 12 |
|
| 13 |
|
| 14 |
func main() { |
| 15 |
list := sll.New[string]() |
| 16 |
list.Add("a") |
| 17 |
list.Append("b") |
| 18 |
list.Prepend("c") |
| 19 |
list.Sort(cmp.Compare[string]) |
| 20 |
_, _ = list.Get(0) |
| 21 |
_, _ = list.Get(100) |
| 22 |
_ = list.Contains("a", "b", "c") |
| 23 |
_ = list.Contains("a", "b", "c", "d") |
| 24 |
list.Remove(2) |
| 25 |
list.Remove(1) |
| 26 |
list.Remove(0) |
| 27 |
list.Remove(0) |
| 28 |
_ = list.Empty() |
| 29 |
_ = list.Size() |
| 30 |
list.Add("a") |
| 31 |
list.Clear() |
| 32 |
} |