File tree Expand file tree Collapse file tree 2 files changed +3
-12
lines changed Expand file tree Collapse file tree 2 files changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -57,12 +57,8 @@ public void Add(T item)
57
57
current = current . Next ;
58
58
}
59
59
60
- // Item not found, add it
61
- if ( previous != null )
62
- {
63
- previous . Next = new BagNode < T > ( item ) ;
64
- totalCount ++ ;
65
- }
60
+ previous ! . Next = new BagNode < T > ( item ) ;
61
+ totalCount ++ ;
66
62
}
67
63
68
64
/// <summary>
@@ -79,11 +75,6 @@ public void Clear()
79
75
/// </summary>
80
76
public int Count => totalCount ;
81
77
82
- /// <summary>
83
- /// Gets the total number of items in the bag, including all multiplicities.
84
- /// </summary>
85
- public int TotalCount => totalCount ;
86
-
87
78
/// <summary>
88
79
/// Returns a boolean indicating whether the bag is empty.
89
80
/// </summary>
Original file line number Diff line number Diff line change @@ -10,5 +10,5 @@ public class BagNode<T>(T item)
10
10
11
11
public int Multiplicity { get ; set ; } = 1 ;
12
12
13
- public BagNode < T > ? Next { get ; set ; } = null ;
13
+ public BagNode < T > ? Next { get ; set ; }
14
14
}
You can’t perform that action at this time.
0 commit comments