Code example for TreeSet

Methods: add, contains

0
		MsgUser user = users.get(name);
		if(user == null)
			return -1; 
		if(!users.get(name).getPassword().equals(password))
			return -2; 
		if(online.contains(user))
			return -3; 
		 
		for(MsgUser u : online){
			u.addBuddy(user);
		} 
		user.openDialogue(online);
		online.add(user);
 
		return 0; 
	} 
 
	public void logout(MsgUser u){
		online.remove(u);
		for(MsgUser user : online)
			user.removeBuddy(u);