Skip to content

Commit

Permalink
docs: update readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
ghosind committed Aug 3, 2022
1 parent c11f4d0 commit 2b4cec2
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,51 @@
# collection
Generic collections framework for Golang.

![Test](https://github.com/ghosind/collection/workflows/collection/badge.svg)
[![codecov](https://codecov.io/gh/ghosind/collection/branch/main/graph/badge.svg)](https://codecov.io/gh/ghosind/collection)
[![Latest version](https://img.shields.io/github/v/release/ghosind/collection?include_prereleases)](https://github.com/ghosind/collection)
![License Badge](https://img.shields.io/github/license/ghosind/collection)
[![Go Reference](https://pkg.go.dev/badge/github.com/ghosind/collection.svg)](https://pkg.go.dev/github.com/ghosind/collection)

Generics collections framework for Golang.

> IMPORTANT NOTICE: This package requires Go version 1.18+.
## Overview

This package provides the following data structure interfaces and implementations:

- `Collection`: The root interface of most of the structures in this package.

- `Set`: A collection interface that contains no duplicate elements.

- [`HashSet`](https://pkg.go.dev/github.com/ghosind/collection#HashSet): The implementation of Set based on Go built-in map structure.

## Installation

You can install this package by the following command.

```sh
go get -u github.com/ghosind/collection
```

After installation, you can import it by the following code.

```go
import "github.com/ghosind/collection"
```

## Examples

### HashSet Examples

Create a string set, add and test elements in the set.

```go
fruits := collection.NewHashSet[string]()

fruits.Add("Apple")
fruits.Add("Banana")

log.Print(fruits.Contains("Banana")) // true
log.Print(fruits.Contains("Lemon"))
```

0 comments on commit 2b4cec2

Please sign in to comment.