Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while ((client_cmd = client_Data.readLine())!=null){
- String[] cmd = client_cmd.split(",");
- String request = cmd[0];
- // System.out.println("Checking varibles for request : "+ request+ " "+i+"th command \n");
- if(request.equalsIgnoreCase(PUT)){
- HashKeyVal.put(cmd[1], cmd[2]);
- System.out.println("pair with key : "+cmd[1]+" and value :"+cmd[2]+" is added to the Map");
- } else if(request.equalsIgnoreCase(GET)){
- String foundVal = null;
- foundVal = HashKeyVal.get(cmd[1]);
- System.out.println("found value : "+ foundVal +" for key : "+cmd[1]);
- } else if(request.equalsIgnoreCase(DELETE)){
- HashKeyVal.remove(cmd[1]);
- System.out.println("Value with key " + cmd[1] + " was successfully deleted");
- }
- i++
- System.out.println("=============================map vals================ \n");
- Iterator iterator = HashKeyVal.keySet().iterator();
- while (iterator.hasNext()) {
- String key = iterator.next().toString();
- String value = HashKeyVal.get(key).toString();
- System.out.println(key + "--->>" + value);
- }
- System.out.println("=============================map vals================ "+i+" \n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement