Skip to content
This repository has been archived by the owner on Aug 3, 2018. It is now read-only.

Commit

Permalink
Reflect recent changes to Readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
fatih committed Mar 16, 2014
1 parent e51916b commit e5284e5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Expand Up @@ -26,9 +26,11 @@ go get github.com/fatih/set

// create a set with zero items
s := set.New()
s := set.NewNonTS() // non thread-safe version

// ... or with some initial values
s := set.New("istanbul", "frankfurt", 30.123, "san francisco", 1234)
s := set.NewNonTS("kenya", "ethiopia", "sumatra")

```

Expand Down Expand Up @@ -114,19 +116,19 @@ b := set.New("frankfurt", "berlin")

// creates a new set with the items in a and b combined.
// [frankfurt, berlin, ankara, san francisco]
c := a.Union(b)
c := set.Union(a, b)

// contains items which is in both a and b
// [berlin]
c := a.Intersection(b)
c := set.Intersection(a, b)

// contains items which are in a but not in b
// [ankara, san francisco]
c := a.Difference(b)
c := set.Difference(a, b)

// contains items which are in one of either, but not in both.
// [frankfurt, ankara, san francisco]
c := a.SymmetricDifference(b)
c := set.SymmetricDifference(a, b)

```

Expand Down Expand Up @@ -169,12 +171,12 @@ s := set.New("ankara", "5", "8", "san francisco", 13, 21)

// convert s into a slice of strings (type is []string)
// [ankara 5 8 san francisco]
t := s.StringSlice()
t := set.StringSlice(s)


// u contains a slice of ints (type is []int)
// [13, 21]
u := s.IntSlice()
u := set.IntSlice(s)

```

Expand All @@ -197,7 +199,7 @@ import (
func main() {
var wg sync.WaitGroup // this is just for waiting until all goroutines finish

// Initialize our Set
// Initialize our thread safe Set
s := set.New()

// Add items concurrently (item1, item2, and so on)
Expand All @@ -217,7 +219,6 @@ func main() {
}
```


## Credits

* [Fatih Arslan](https://github.com/fatih)
Expand Down

0 comments on commit e5284e5

Please sign in to comment.