void printMap(){ for(int i = 0; i<keys->getLength();i++){ cout<< "Key: "<<keys->get(i)<<endl; valarray->get(i)->display(); cout<<endl; } }
int count(const char* key){ DynArray<int> * a = valarray->get(keys->indexofVal(key)); int count = 0; for(int i = 0; i<a->getLength();i++){ if(a->get(i) >= 0){ count++; } } return count; }
void set(const char * key, int val){ if(keys->isIn(key)){ valarray->get(keys->indexofVal(key))->add(val); } else{ keys->add(key); DynArray<int> *vala = new DynArray<int>(); vala->add(val); valarray->add(vala); } }
DynArray<int>* getAll(const char* key){ return valarray->get(keys->indexofVal(key)); }
void removeAll(const char* key){ valarray->get(keys->indexofVal(key))->clear(); }