diff --git a/src/Shared/HandyControl_Shared/Tools/Queue/Deque!1.cs b/src/Shared/HandyControl_Shared/Tools/Queue/Deque!1.cs index d15c992c..cb44085f 100644 --- a/src/Shared/HandyControl_Shared/Tools/Queue/Deque!1.cs +++ b/src/Shared/HandyControl_Shared/Tools/Queue/Deque!1.cs @@ -65,19 +65,11 @@ namespace HandyControl.Tools public Deque(IEnumerable backCollection, IEnumerable frontCollection) { - if (backCollection == null && frontCollection == null) throw new ArgumentException("Collections cannot both be null"); - _front = new List(); - _back = new List(); + if (backCollection == null && frontCollection == null) + throw new ArgumentException("Collections cannot both be null"); - if (backCollection != null) - { - foreach (var item in backCollection) _back.Add(item); - } - - if (frontCollection != null) - { - foreach (var item in frontCollection) _front.Add(item); - } + _front = frontCollection != null ? new List(frontCollection) : new List(); + _back = backCollection != null ? new List(backCollection) : new List(); } public void AddFirst(T item)