Question: ```
MAP_PERSONAL_DATA_WITH_TAG = {"Flat/Unit No." => "FLD_ADD_1Line1",
                          "Building No./Name" => "FLD_ADD_2Line2",
                          "Street" => "FLD_ADD_3Line3",
                          "Postcode" => "FLD_ADD_4Postcode",
                          "City/Town" => "FLD_ADD_5City",
                          "Region" => "FLD_ADD_6State",
                          "Suburb" => "FLD_ADD_Town"
}

data_hash = {"Street" => "s", "Suburb" => "sb", "abc" => "hdkhd"}

data_hash.each do |key, value|
  case key
  when  <if key equal to the key of MAP_PERSONAL_DATA_WITH_TAG i.e    MAP_PERSONAL_DATA_WITH_TAG.has_key?(key)>
    puts 'something'
  when "Mobile"
    puts "something mobile"
  else
    puts 'something else'
  end
end

```

Rather than writing like 

when "Flat/Unit No.","Building No./Name","Street","Postcode","City/Town","Region","Suburb"

Is there any better way to write this?

Answer: 
Instead of checking for all words that have the letter "a" check for all words that have an 'a' in the second position. You can use `string.charAt(1) == 'a'` to accomplish this.

You could write a method that checks an array for letters and returns an `ArrayList` with all of the words like this.

```
public static List<String> getWords(String[] words, char c, int position) {
    List<String> result = new ArrayList<String>;
    for (String s : words) {
        if (position > s.length - 1)
            continue;
        if (s.charAt(position) == c)
            result.add(s);
    }
    return result;
}

```
A simple solution could be iterating and checking for character:

```
// String[] candidateWords is your list of words,
// int targetIndex, is the index you want to check (i.e. 2)
// char targetChar, is the character you want in that position (i.e. a)

for(int i=0; i < candidateWords.length; i++)
    if(candidateWords[i].charAt(targetIndex-1) == targetChar){
       //do something (print/store word ecc..)
    }

```