If you develop for Android KitKat or newer, you could also use a switch statement (see: Android coding with switch (String)). e.g.
switch(yourString)
{
case "john":
//do something for john
case "mary":
//do something for mary
}