Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zyedidia committed Apr 13, 2022
1 parent 8166217 commit 7383fd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions hashmap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,55 +68,55 @@ type Map[K, V any] struct {
}
```

### func [New](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L35>)
### func [New](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L43>)

```go
func New[K, V any](capacity uint64, equals g.EqualsFn[K], hash g.HashFn[K]) *Map[K, V]
```

New constructs a new map with the given capacity\.

### func \(\*Map\[K\, V\]\) [Copy](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L165>)
### func \(\*Map\[K\, V\]\) [Copy](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L174>)

```go
func (m *Map[K, V]) Copy() *Map[K, V]
```

Copy returns a copy of this map\. The copy will not allocate any memory until the first write\, so any number of read\-only copies can be made without any additional allocations\.

### func \(\*Map\[K\, V\]\) [Each](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L178>)
### func \(\*Map\[K\, V\]\) [Each](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L187>)

```go
func (m *Map[K, V]) Each(fn func(key K, val V))
```

Each calls 'fn' on every key\-value pair in the hashmap in no particular order\.

### func \(\*Map\[K\, V\]\) [Get](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L51>)
### func \(\*Map\[K\, V\]\) [Get](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L60>)

```go
func (m *Map[K, V]) Get(key K) (V, bool)
```

Get returns the value stored for this key\, or false if there is no such value\.

### func \(\*Map\[K\, V\]\) [Put](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L88>)
### func \(\*Map\[K\, V\]\) [Put](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L97>)

```go
func (m *Map[K, V]) Put(key K, val V)
```

Put maps the given key to the given value\. If the key already exists its value will be overwritten with the new value\.

### func \(\*Map\[K\, V\]\) [Remove](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L128>)
### func \(\*Map\[K\, V\]\) [Remove](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L137>)

```go
func (m *Map[K, V]) Remove(key K)
```

Remove removes the specified key\-value pair from the map\.

### func \(\*Map\[K\, V\]\) [Size](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L158>)
### func \(\*Map\[K\, V\]\) [Size](<https://github.com/zyedidia/generic/blob/master/hashmap/map.go#L167>)

```go
func (m *Map[K, V]) Size() int
Expand Down
10 changes: 5 additions & 5 deletions multimap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ There are four implementations of the MultiMap data structure\, identified by se
- [func NewMapSlice[K, V comparable]() MultiMap[K, V]](<#func-newmapslice>)


## type MultiMap
## type [MultiMap](<https://github.com/zyedidia/generic/blob/master/multimap/multimap.go#L11-L40>)

MultiMap is an associative container that contains a list of key\-value pairs\, while permitting multiple entries with the same key\.

Expand Down Expand Up @@ -56,31 +56,31 @@ type MultiMap[K, V any] interface {
}
```

### func NewAvlSet
### func [NewAvlSet](<https://github.com/zyedidia/generic/blob/master/multimap/avl.go#L109>)

```go
func NewAvlSet[K, V any](keyLess g.LessFn[K], valueLess g.LessFn[V]) MultiMap[K, V]
```

NewAvlSet creates a MultiMap using AVL tree and AVL set\. \- Duplicate entries are not permitted\. \- Both keys and values are sorted\.

### func NewAvlSlice
### func [NewAvlSlice](<https://github.com/zyedidia/generic/blob/master/multimap/avl.go#L95>)

```go
func NewAvlSlice[K any, V comparable](keyLess g.LessFn[K]) MultiMap[K, V]
```

NewAvlSlice creates a MultiMap using AVL tree and builtin slice\. \- Value type must be comparable\. \- Duplicate entries are permitted\. \- Keys are sorted\, but values are unsorted\.

### func NewMapSet
### func [NewMapSet](<https://github.com/zyedidia/generic/blob/master/multimap/map.go#L108>)

```go
func NewMapSet[K comparable, V any](valueLess g.LessFn[V]) MultiMap[K, V]
```

NewMapSet creates a MultiMap using builtin map and AVL set\. \- Key type must be comparable\. \- Duplicate entries are not permitted\. \- Values are sorted\, but keys are unsorted\.

### func NewMapSlice
### func [NewMapSlice](<https://github.com/zyedidia/generic/blob/master/multimap/map.go#L94>)

```go
func NewMapSlice[K, V comparable]() MultiMap[K, V]
Expand Down

0 comments on commit 7383fd2

Please sign in to comment.