File tree Expand file tree Collapse file tree 3 files changed +0
-59
lines changed
src/Advanced.Algorithms/DataStructures/Tree Expand file tree Collapse file tree 3 files changed +0
-59
lines changed Original file line number Diff line number Diff line change @@ -596,11 +596,6 @@ IEnumerator IEnumerable.GetEnumerator()
596596
597597 public IEnumerator < T > GetEnumerator ( )
598598 {
599- if ( nodeLookUp != null )
600- {
601- return new BSTNodeLookUpEnumerator < T > ( nodeLookUp ) ;
602- }
603-
604599 return new BSTEnumerator < T > ( Root ) ;
605600 }
606601 }
Original file line number Diff line number Diff line change @@ -755,11 +755,6 @@ IEnumerator IEnumerable.GetEnumerator()
755755
756756 public IEnumerator < T > GetEnumerator ( )
757757 {
758- if ( nodeLookUp != null )
759- {
760- return new BSTNodeLookUpEnumerator < T > ( nodeLookUp ) ;
761- }
762-
763758 return new BSTEnumerator < T > ( Root ) ;
764759 }
765760 }
Original file line number Diff line number Diff line change @@ -59,53 +59,4 @@ public void Dispose()
5959 }
6060 }
6161
62- // implement IEnumerator.
63- internal class BSTNodeLookUpEnumerator < T > : IEnumerator < T > where T : IComparable
64- {
65- private readonly Dictionary < T , BSTNodeBase < T > > nodeLookUp ;
66- private Dictionary < T , BSTNodeBase < T > > . Enumerator enumerator ;
67- private T current ;
68-
69- internal BSTNodeLookUpEnumerator ( Dictionary < T , BSTNodeBase < T > > nodeLookUp )
70- {
71- this . nodeLookUp = nodeLookUp ;
72- enumerator = nodeLookUp . GetEnumerator ( ) ;
73- }
74-
75- public bool MoveNext ( )
76- {
77- if ( nodeLookUp == null )
78- {
79- return false ;
80- }
81-
82- if ( enumerator . MoveNext ( ) )
83- {
84- current = enumerator . Current . Key ;
85- return true ;
86- }
87-
88- return false ;
89- }
90-
91- public void Reset ( )
92- {
93- enumerator = nodeLookUp . GetEnumerator ( ) ;
94- }
95-
96- public T Current
97- {
98- get
99- {
100- return current ;
101- }
102- }
103-
104- object IEnumerator . Current => Current ;
105-
106- public void Dispose ( )
107- {
108- enumerator . Dispose ( ) ;
109- }
110- }
11162}
You can’t perform that action at this time.
0 commit comments