coffee
所属分类:人工智能/神经网络/深度学习
开发工具:GO
文件大小:26KB
下载次数:0
上传日期:2022-05-16 11:52:39
上 传 者:
sh-1993
说明: Golang的通用编程工具包。
(General programming toolkit for Golang.)
文件列表:
LICENSE (11357, 2022-05-16)
bitmap (0, 2022-05-16)
bitmap\bitmap.go (501, 2022-05-16)
bitmap\bitmap_test.go (127, 2022-05-16)
bloom (0, 2022-05-16)
bloom\bloom_filter.go (14, 2022-05-16)
bst (0, 2022-05-16)
bst\binary_search_tree.go (2261, 2022-05-16)
cache (0, 2022-05-16)
cache\arc_cache.go (14, 2022-05-16)
example (0, 2022-05-16)
example\array_queue.go (347, 2022-05-16)
example\bst.go (363, 2022-05-16)
example\linked_list.go (393, 2022-05-16)
example\linked_queue.go (268, 2022-05-16)
example\resource_pool.go (747, 2022-05-16)
example\ring_queue.go (396, 2022-05-16)
example\sort_map.go (604, 2022-05-16)
example\stack.go (322, 2022-05-16)
go.mod (40, 2022-05-16)
hashring (0, 2022-05-16)
hashring\hash_ring.go (0, 2022-05-16)
hashring\hashed.go (17, 2022-05-16)
heap (0, 2022-05-16)
heap\heap.go (1288, 2022-05-16)
heap\heap_test.go (602, 2022-05-16)
iterator.go (1060, 2022-05-16)
list (0, 2022-05-16)
list\linked_list.go (1468, 2022-05-16)
list\linked_list_test.go (882, 2022-05-16)
number.go (239, 2022-05-16)
obj (0, 2022-05-16)
obj\object.go (55, 2022-05-16)
pool (0, 2022-05-16)
pool\resource_pool.go (1358, 2022-05-16)
pool\resource_pool_test.go (1118, 2022-05-16)
queue (0, 2022-05-16)
... ...
# coffee
General programming toolkit for Golang.
---
### Quick Start
[1. List](https://github.com/auula/coffee/blob/master/#List)
[2. Stack](https://github.com/auula/coffee/blob/master/#Stack)
---
## List
LinkedList enhanced operation API:
```go
package main
import (
"fmt"
"github.com/auula/coffee"
"github.com/auula/coffee/list"
)
func main() {
ls := list.New[int](https://github.com/auula/coffee/blob/master/)
for i := 0; i < 10; i++ {
ls.RPush(i) // Insert from the right
}
fmt.Println("Front:", ls.Front()) // Get element from head
for i := 0; i < 20; i++ {
ls.LPush(i) // Insert from the left
}
fmt.Println("Back:", ls.Back()) // Get element from tail
coffee.ForEach(ls.Iter(), func(i int) {
fmt.Println(i)
})
}
```
## Stack
Stack enhanced operation API:
```go
package main
import (
"fmt"
"github.com/auula/coffee"
"github.com/auula/coffee/stack"
)
func main() {
s := stack.New[int](https://github.com/auula/coffee/blob/master/)
for i := 1; i <= 100; i++ {
s.Push(i)
}
sum := 0
coffee.ForEach(s.Iter(), func(i int) {
sum += i
})
fmt.Println(s.Pop())
fmt.Println(sum)
}
```
近期下载者:
相关文件:
收藏者: