title: How to check value is exist in ArrayList<Hashmap<String,String>> in android?
body: <p>First i insert the data when no records in database it works.
  but when new data will come from server i want to check server record is exist in database or not for that i get all records from database and than i use hashmap loop for this if record is exist than update record otherwise insert new record</p>
  
  <p>Here i put my code you can check it </p>
  
  <pre><code>String data=loadJSONFromAsset();
              Log.e("data","---&gt;"+data);
              try 
              {   
  
                  Open_Database();
  
                  JSONObject jobject= new JSONObject(data);
                  JSONArray jstore= jobject.getJSONArray(WS_Constant.GETALLSSID.STORETERMINALINFO);
  
                  myDBwifilist=mDB_Helper.GetAllRecord(mSQLiteDatabase,DB_Constant.TABLE.MYWIFI);
                  Log.d("Record Count","-----&gt;"+myDBwifilist.size());
  
                  // json array must &gt; 0
                  if(jstore.length()&gt;0)
                  {
  
                      for(int i=0;i&lt;jstore.length();i++)
                      {
  
                          if(myDBwifilist.size()&lt;=0)
                          {   
                                  mDB_Helper.Insert_MYWIFI_Table(mSQLiteDatabase,
                                                      jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.WIFINAME),
                                                      jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.TERMINAL_ID),
                                                      jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.STORE_ID),
                                                      jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.LONGITUDE),
                                                      jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.LATITUDE));
                          }
                          else
                          {   
  
                                  for (HashMap&lt;String, String&gt; map : myDBwifilist) 
                                  {
                                        for (String key : map.keySet()) 
                                        {
                                                if (key.equals(DB_Constant.MYWIFI.TERMINAL_ID)) 
                                                {
                                                       if(map.get(key).equals(jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.TERMINAL_ID)))
                                                       {
                                                          int check=mDB_Helper.UpdateALLSSID(mSQLiteDatabase,
                                                                  jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.TERMINAL_ID),
                                                                  jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.WIFINAME),
                                                                  jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.STORE_ID),
                                                                  jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.LONGITUDE),
                                                                  jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.LATITUDE));
                                                           Log.d("Record Update", "----------&gt; True"+check);
                                                       }
                                                       else
                                                       {
                                                           mDB_Helper.Insert_MYWIFI_Table(mSQLiteDatabase,
                                                                      jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.WIFINAME),
                                                                      jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.TERMINAL_ID),
                                                                      jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.STORE_ID),
                                                                      jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.LONGITUDE),
                                                                      jstore.getJSONObject(i).getString(WS_Constant.GETALLSSID.LATITUDE));
  
                                                           Log.d("Record Update", "----------&gt; false");
                                                       }
                                                }
                                         }
                                  }
  
                          }
  
                      }
                  }
                  else
                  {
  
  
                  }
  
                  Close_Database();
  
              } 
              catch (JSONException e) 
              {
                  e.printStackTrace();
              }
  </code></pre>
  
  <blockquote>
    <p>// Get Records From Database</p>
  </blockquote>
  
  <pre><code>public ArrayList&lt;HashMap&lt;String,String&gt;&gt; GetAllRecord(SQLiteDatabase db, String TableName) 
        {
  
              ArrayList&lt;HashMap&lt;String, String&gt;&gt; data = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;();
  
              String Query = "SELECT * FROM " + TableName;
              Cursor cursor = db.rawQuery(Query, null);
              if(cursor.getCount()&lt;=0)
              {
                         cursor.close();
                          return data;
              }
              else
              {
                   if (cursor.moveToFirst()) 
                   {
                       do 
                       {
                           HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
                           map.put(DB_Constant.MYWIFI.WIFINAME, cursor.getString(cursor.getColumnIndex(DB_Constant.MYWIFI.WIFINAME)));
                           map.put(DB_Constant.MYWIFI.TERMINAL_ID, cursor.getString(cursor.getColumnIndex(DB_Constant.MYWIFI.TERMINAL_ID)));
                           map.put(DB_Constant.MYWIFI.STORE_ID, cursor.getString(cursor.getColumnIndex(DB_Constant.MYWIFI.STORE_ID)));
                           map.put(DB_Constant.MYWIFI.LONGITUDE, cursor.getString(cursor.getColumnIndex(DB_Constant.MYWIFI.LONGITUDE)));
                           map.put(DB_Constant.MYWIFI.LATITUDE, cursor.getString(cursor.getColumnIndex(DB_Constant.MYWIFI.LATITUDE)));
                          data.add(map);
  
                       } while (cursor.moveToNext());
  
                   }
               }       
              cursor.close();
              return data;
        }
  
  public int UpdateALLSSID(SQLiteDatabase db,String terminalid, 
                               String wifiname,
                               String storeid,
                               String longitude,
                               String latitude)
        {
  
  
            Log.e("terminalid","---&gt;"+terminalid);
  
            ContentValues cv = new ContentValues();
            cv.put(DB_Constant.MYWIFI.WIFINAME,wifiname); 
            cv.put(DB_Constant.MYWIFI.STORE_ID,storeid);
            cv.put(DB_Constant.MYWIFI.LONGITUDE,longitude);
            cv.put(DB_Constant.MYWIFI.LATITUDE,latitude);
            return db.update(DB_Constant.TABLE.MYWIFI, cv,DB_Constant.MYWIFI.TERMINAL_ID +" = "+terminalid, null);
  
  
        }
  </code></pre>