Java Easy HashMap


#1

public class Solution {
// DO NOT MODIFY THE LIST. IT IS READ ONLY
public int singleNumber(final List A) {

    HashMap<Integer,Integer> map=new HashMap<>();
    int arr[]=new int[26];
    for(int i=0;i<A.size();i++) {
        int k=A.get(i);
        if(map.containsKey(k)) map.put(k,map.get(k)+1);
        else 
        map.put(k,1);
    }
    
      for (Map.Entry<Integer,Integer> entry : map.entrySet())  {
        
        if(entry.getValue()==1) return entry.getKey();
        else continue;
      }
        return -1;
}

}


#2

It doesnt meet required criteria!