Skip to content

Commit 1d83bdd

Browse files
committed
can avoid craetion of temporary list
1 parent 4553a26 commit 1d83bdd

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/main/net-core/Diff/DOMDifferenceEngine.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,11 @@ private ComparisonState CompareNodeLists(IEnumerable<XmlNode> allControlChildren
468468

469469
IEnumerable<KeyValuePair<XmlNode, XmlNode>> matches =
470470
NodeMatcher.Match(controlSeq, testSeq);
471-
IList<XmlNode> controlListForXpath = new List<XmlNode>(allControlChildren);
472-
IList<XmlNode> testListForXpath = new List<XmlNode>(allTestChildren);
473471
IList<XmlNode> controlList = new List<XmlNode>(controlSeq);
474472
IList<XmlNode> testList = new List<XmlNode>(testSeq);
475473

476-
IDictionary<XmlNode, int> controlListForXpathIndex = Index(controlListForXpath);
477-
IDictionary<XmlNode, int> testListForXpathIndex = Index(testListForXpath);
474+
IDictionary<XmlNode, int> controlListForXpathIndex = Index(allControlChildren);
475+
IDictionary<XmlNode, int> testListForXpathIndex = Index(allTestChildren);
478476
IDictionary<XmlNode, int> controlListIndex = Index(controlList);
479477
IDictionary<XmlNode, int> testListIndex = Index(testList);
480478

@@ -743,7 +741,7 @@ private static XmlAttribute FindMatchingAttr(IList<XmlAttribute> attrs,
743741
return null;
744742
}
745743

746-
private static IDictionary<XmlNode, int> Index(IList<XmlNode> nodes) {
744+
private static IDictionary<XmlNode, int> Index(IEnumerable<XmlNode> nodes) {
747745
IDictionary<XmlNode, int> indices = new Dictionary<XmlNode, int>();
748746
int idx = 0;
749747
foreach (XmlNode n in nodes) {

0 commit comments

Comments
 (0)