contains elements hashmap in arraylist java -


i have hashmap<integer,arraylist<integer>> h , arraylist<integer> l want test if first element in arraylist similar @ first value in hashmap want

 (entry<integer, arraylist<integer>> e : hmm.entryset()) {         integer key1 = e.getkey();          list<integer> valeur = e.getvalue();         int count = 0;         int k = 0;         //integer temp : listoperateur;          if (valeur.contains(listoperateur)) {             count++;           }          sim.put(key1, count);         k++;      } 

this code can you

    iterator i1 = listoperateur.iterator();     (map.entry<integer, arraylist<integer>> e : hmm.entryset()) {        //if (e.getvalue() != null) {             count = 0;             //you can move part method avoid deep nested code             (integer mapvalue : e.getvalue()) {                 // (integer listvalue : listoperateur) {                 if (mapvalue.equals(listoperateur.get(k))) {                     count++;                     //  }                 }             }             sim.put(e.getkey(), count);             k++;       //  }     } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -