Releases: jucardi/go-streams
Releases · jucardi/go-streams
Golang Generics Support
- Refactored this library and all implementation to use Golang Generics.
- Added base implementations of collections and iterators with abstract members so they can be used as base for new implementations of these types.
- Existing interfaces have been revisited and redesigned to go more accordingly to what they are meant to represent.
ICollection[T comparable]
is now more generic and have no predifined functions related to indexes.- Added new interface type
IList[T comparable]
which implementsICollection[T comparable]
with the addition to functions related to indexes in a list, such asIndex
,At
andRemoveAt
- Added new interface type
ISet[T comparable]
which implementsICollection[T comparable]
and defines collections with only unique values. - Added default implementation of
ISet[T]
. - Added new interface type
Map[K,V comparable]
which implementsICollection[KeyValuePair[K,V]]
and has additional functions related to maps. - Added default implementation of
Map[K,V comparable]
which also uses a mutex to be thread safe. - Moved the function
Map
out ofIStream[T]
since Golang Generics does not support additional generic parameters to interface functions. - The
Map
function is now a static function in the 'streams' package and has been redesigned toMap[From,To comparable](source any, ConvertFunc[From,To]) IList[To]
where the source can be[]From
orIIterator[From]
- Added mapping function
MapNonComparable[From, To any](source any, ConvertFunc[From, To]) []To
for simple cases where the use of streams is not required for a mapping and allowing non-comparable types to be used - Added mapping function
MapToPtr[T any]() []*T
to easily convert arrays of non-comparable structures to arrays of pointers to that structure (T
to*T
) which allows the resulting array to be used in streams