Skip to content

Releases: charbz/gophers

Gophers v1.1.0

Choose a tag to compare

@charbz charbz released this 25 Nov 10:52
54113d6

Release v1.1.0

Features

Iterator methods

All Collections now offer a group of methods that return an iterator to the result as opposed to a new collection.
These methods can be used with the for ... range keywords to iterate over each resulting element.

  • Filtered returns an iterator to the result of a filter operation
  • Rejected returns an iterator to the result of an inverse filter operation
  • Diffed returns an iterator to the result of a diff operation
  • Intersected returns an iterator to the result of an intersection operation
  • Concatenated returns an iterator to the result of a concat operation
  • Distincted returns an iterator to the result of a distinct operation
  • Unioned returns an iterator to the result of a union operation applicable only to sets
  • Mapped returns an iterator to the result of a map operation

Example Usage:

nums := list.NewComparableList([]int{1, 2, 3, 4, 5, 6})

for i := range nums.Filtered(func(v int) bool { return v%2 == 0 }) {
  fmt.Printf("filtered %v\n", i)
}
// filtered 2
// filtered 4
// filtered 6

New methods

  • Reject is now an alias for FilterNot
  • Diff is now a method available on all collections
  • Intersect is now a method available on all collections
  • StartsWith checks wether a collection starts with a given sub-collection, available on comparable collections
  • EndsWith checks wether a collection ends with a given sub-collection, available on comparable collections

Bug Fixes

  • Fixed a bug with the Concat method for comparable collections
  • Fixed a bug with the Clone method for comparable collections
  • Fixed a bug with the Corresponds method for comparable collection

Thank you for using Gophers. If you find any issues please report them in one of the following places:

Gophers v1.0.0

Choose a tag to compare

@charbz charbz released this 20 Nov 01:35
81cdfaa

This release contains some breaking changes:

  • Drop the pkg/ dir and move everything to root
  • Remove the stretchr/testify package to reduce dependencies
  • Update Readme

Gophers v0.1.0

Choose a tag to compare

@charbz charbz released this 19 Nov 10:05
b04ff9c

This is the first release of the Gophers package. With support for the following collection types:

  • Sequence : An ordered collection wrapping a Go slice. Great for fast random access.
  • ComparableSequence : A Sequence of comparable elements. Offers extra functionality.
  • List : An ordered collection wrapping a linked list. Great for fast insertion, removal, and implementing stacks and queues.
  • ComparableList : A List of comparable elements. Offers extra functionality.
  • Set : A hash set of unique elements.

To read the full documentation, check out pkg.go.dev/github.com/charbz/gophers