ArrayList issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anthony Kwang
    New Member
    • Mar 2011
    • 1

    ArrayList issue

    Hi,

    Basically i have 2 arraylist and 1 hashmap and i want to store the value inside the hashmap. but my codes seem never do any comparison.

    Code:
    for (String bigram1 : bigram) {
                for (String words : a2) {
                        if (words.contains(bigram1)){
                          if(test.containsKey(bigram1)) {
                          test.get(bigram1).add(words);
                          }
                        else {
                          test.put(bigram1, new ArrayList<String>(a2));
                        }
                    }
                }
            }
              System.out.println(test);
    instead it displayed all the values.

    its should be like {ev = [every]} and not {ev = [every, errant, word]} because ev is substring belong to every and not errant and word.

    Thanks.
Working...