Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.56 KB | None | 0 0
  1.    while ((client_cmd = client_Data.readLine())!=null){
  2.                   String[] cmd = client_cmd.split(",");
  3.  
  4.                   String request = cmd[0];
  5.  
  6.                 //  System.out.println("Checking varibles for request : "+ request+ " "+i+"th command \n");
  7.                   if(request.equalsIgnoreCase(PUT)){
  8.  
  9.                         HashKeyVal.put(cmd[1], cmd[2]);
  10.                         System.out.println("pair with key : "+cmd[1]+" and value :"+cmd[2]+" is added to the Map");
  11.  
  12.                   } else if(request.equalsIgnoreCase(GET)){
  13.                       String foundVal = null;
  14.                       foundVal =  HashKeyVal.get(cmd[1]);
  15.                       System.out.println("found value : "+ foundVal +" for key : "+cmd[1]);
  16.  
  17.                   } else if(request.equalsIgnoreCase(DELETE)){
  18.                     HashKeyVal.remove(cmd[1]);
  19.                     System.out.println("Value with key " + cmd[1] + " was successfully deleted");
  20.  
  21.                   }
  22.                   i++
  23.                   System.out.println("=============================map vals================ \n");
  24.                   Iterator iterator = HashKeyVal.keySet().iterator();
  25.  
  26.                      while (iterator.hasNext()) {
  27.                             String key = iterator.next().toString();
  28.                             String value = HashKeyVal.get(key).toString();
  29.                             System.out.println(key + "--->>" + value);
  30.                      }
  31.                   System.out.println("=============================map vals================ "+i+" \n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement