fix: IcdHashSet preserves comparer when an operation creates a new IcdHashSet

This commit is contained in:
Chris Cameron
2019-01-03 13:03:51 -05:00
parent 470c35cab7
commit 4cd28a8a12
2 changed files with 6 additions and 4 deletions

View File

@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Changed
- IcdHashSet preserves comparer when an operation creates a new IcdHashSet
## [8.1.0] - 2019-01-02 ## [8.1.0] - 2019-01-02
### Added ### Added

View File

@@ -95,7 +95,7 @@ namespace ICD.Common.Utils.Collections
if (set == null) if (set == null)
throw new ArgumentNullException("set"); throw new ArgumentNullException("set");
IcdHashSet<T> unionSet = new IcdHashSet<T>(this); IcdHashSet<T> unionSet = new IcdHashSet<T>(m_Dict.Comparer, this);
unionSet.AddRange(set); unionSet.AddRange(set);
return unionSet; return unionSet;
@@ -112,7 +112,7 @@ namespace ICD.Common.Utils.Collections
if (set == null) if (set == null)
throw new ArgumentNullException("set"); throw new ArgumentNullException("set");
IcdHashSet<T> subtractSet = new IcdHashSet<T>(this); IcdHashSet<T> subtractSet = new IcdHashSet<T>(m_Dict.Comparer, this);
foreach (T item in set) foreach (T item in set)
subtractSet.Remove(item); subtractSet.Remove(item);
@@ -131,7 +131,7 @@ namespace ICD.Common.Utils.Collections
if (set == null) if (set == null)
throw new ArgumentNullException("set"); throw new ArgumentNullException("set");
IcdHashSet<T> intersectionSet = new IcdHashSet<T>(); IcdHashSet<T> intersectionSet = new IcdHashSet<T>(m_Dict.Comparer);
foreach (T item in set.Where(Contains)) foreach (T item in set.Where(Contains))
intersectionSet.Add(item); intersectionSet.Add(item);
@@ -150,7 +150,7 @@ namespace ICD.Common.Utils.Collections
if (set == null) if (set == null)
throw new ArgumentNullException("set"); throw new ArgumentNullException("set");
IcdHashSet<T> output = new IcdHashSet<T>(this); IcdHashSet<T> output = new IcdHashSet<T>(m_Dict.Comparer, this);
foreach (T item in set) foreach (T item in set)
{ {