I am very new to using hashmaps, as I was assigned to make a program that will become a basic chat server for telnet clients.

I have included some commands for the user just in case the user wants to send a shoutout, or PM a certain user.
/shout - if the user wants to shoutout.
/msg - if the user wants to send a PM to another user
/bye - disconnects from the server.

now my problem lies within the /msg command. I don't know how to compare 2 different users in a hashmap.

here's a piece of the code..

public class MyChatThread extends Thread{
	private Socket sock;
	private static HashMap <String, MyChatThread> pool = new HashMap<String, MyChatThread>();
	private static HashMap <String, MyChatThread> pool2 = new HashMap<String , MyChatThread>();
 
//other things here...
 
public void run(){
	try{
		dos.writeBytes("Enter name: ");
		String name = dis.readLine().trim();
		System.out.println("The client named "+name+" has connected.");
		pool.put(name, this);
		String rcpt = "";
		String temp = "";
		String command = ""; //gets user command
		dos.writeBytes("Write a command. (/shout to make a shoutout, /msg to PM, and /bye to exit from server.)\r\n");
		command = dis.readLine(); //reads the command of the user.
 
		do{
			if(command.equals("/shout")){ //if user command is /shout
				dos.writeBytes("Your message: ");
				temp = dis.readLine();
				System.out.println("The server has recieved this command: "+ command + " from: " + name);
				System.out.println("The server has recieved this messages: "+ temp + " from: " + name);
				for(MyChatThread v: pool.values()){
					v.ShoutSendMessage(name, temp);
				}
				dos.writeBytes("Write another command: ");
				command = dis.readLine(); //reads another command
 
				}
 
//i tried doing this.
 
			if(command.equals("/msg")){  //if user command is /msg
				System.out.println("The server has recieved this command: "+ command + " from: " + name);
				System.out.println("The server has recieved this messages: "+ temp + " from: " + name);
				dos.writeBytes("Please input the name of the user you want to PM: ");
				rcpt = dis.readLine().trim();
				pool2.put(rcpt, this);
 
				do{
					if(pool.put(name, this) == pool2.put(rcpt, this)){
					dos.writeBytes("Forever Alone? Don't PM yourself. xD \r\n");
					dos.writeBytes("Try again. Please input the name of the user you want to PM: ");
					rcpt = dis.readLine().trim();
					}
				}while(pool.put(rcpt, this) == pool2.put(name, this));
 
				System.out.println("User " + name + " is sending a message to " + rcpt + ".");
				dos.writeBytes("Please write your message: \r\n");
				temp = dis.readLine();
				for(MyChatThread v: pool.values()){
				v.PrivateSendMessage(name, temp, rcpt);
				}
					dos.writeBytes("Write another command: ");
					command = dis.readLine(); //reads another command
 
			}