pub fn add(&mut self, first: String, second: String) {

        if self.words.contains_key(&first) {
            let a= self.words.get_mut(&first).unwrap();

            if a.contains_key(&second) {

                a.insert(second.to_string(), a.get(&second.to_string()).unwrap() + 1);
            } else {
                a.insert(second.to_string(), 1);
            }
        } else {
            let mut hashmap = HashMap::<String, usize>::new();
            hashmap.insert(second.to_string(), 1);

            self.words.insert(first.to_string(), hashmap);
        }
    }
//Add a word to the WordMap, TODO: REWORK
Add a word to the WordMap, TODO: REWORK
Add a word to the WordMap TODO : REWORK
pub fn add(&mut self, first: String, second: String) {
        if self.words.contains_key(&first) {
            let a= self.words.get_mut(&first).unwrap();
            if a.contains_key(&second) {
                a.insert(second.to_string(), a.get(&second.to_string()).unwrap() + 1);
            } else {
                a.insert(second.to_string(), 1);
            }
        } else {
            let mut hashmap = HashMap::<String, usize>::new();
            hashmap.insert(second.to_string(), 1);
            self.words.insert(first.to_string(), hashmap);
        }
    }
pub fn add ( & mut self , first : String , second : String ) { if self . words . contains_key ( & first ) { let a = self . words . get_mut ( & first ) . unwrap ( ) ; if a . contains_key ( & second ) { a . insert ( second . to_string ( ) , a . get ( & second . to_string ( ) ) . unwrap ( ) + 1 ) ; } else { a . insert ( second . to_string ( ) , 1 ) ; } } else { let mut hashmap = HashMap :: < String , usize > :: new ( ) ; hashmap . insert ( second . to_string ( ) , 1 ) ; self . words . insert ( first . to_string ( ) , hashmap ) ; } }
Add a word to the WordMap, TODO: REWORK
Add a word to the WordMap TODO : REWORK
&mut self
first
String
second
String
&mut self
first
String
second
String