Replace ObjArray with built-in List and Stack objects
Replace ObjToIntMap with Dictionary<T, int> and HashSet`1