public static void Main(String[] args) { DoubleSpring ds = new DoubleSpring(); Console.WriteLine("Enter Name-"); var input = Console.ReadLine(); ds.Expand(input); Console.WriteLine("Enter Name-"); input = Console.ReadLine(); ds.Expand(input); Console.WriteLine("Enter Name-"); input = Console.ReadLine(); ds.Expand(input); Console.WriteLine("Enter Name-"); input = Console.ReadLine(); ds.Expand(input); Console.WriteLine("Enter Name-"); input = Console.ReadLine(); ds.Expand(input); Console.WriteLine($"No of Elements-{ds.Count()}"); foreach (var i in ds) { Console.WriteLine(i); Console.WriteLine("-------------"); } ds.Compress(); Console.WriteLine($"No of Elements-{ds.Count()}"); foreach (var j in ds) { Console.WriteLine(j); Console.WriteLine("-------------"); } }
public bool MoveNext() { if (index++ <= DS.Count()) { item = DS[index]; return(true); } else { return(false); } }