Parsing and summarizing an aviation METAR (US) report I have a list of objects, which contains field rawData (eg rawData="KLAX 141353Z 06003KT 6SM BR FEW002 FEW008 BKN280 12/12 A3007 RMK AO2 SLP182 T01170117 $"). In my case rawData is METAR report from which i want to extract the most severe weather condition (clouds, fog, rain, snow).
Currently I am applying parseWeather to each object of my list.

METAR string can contain multiple instance of same tag e.g. (BRN065 BRN033),  it even can contain all of them in same time . To my output - I want to display "simplified" worst weather condition, where the worst, for the current task, is considered as fog, then snow, then other weather conditions.    

To answer why i return same type as argument - initial argument have some pre parsed detailed report from FlightAware service. However I have different requirenment for simplified report, than provided. Thus function parseWeather is a side effect function which fills extra fields. 

  private PollFlightResponse.ResultEntity.MetarEntity parseWeather(
      PollFlightResponse.ResultEntity.MetarEntity d) {

    int severity = 0; //how bad is weather from 0 to 2
    String wCode = ""; // map key
    String weather = ""; // human readable weather
    if (d.getRawData().contains("FG")) {
      wCode = "FG";
    } else if (d.getRawData().contains("+SN")) {
      wCode = "+SN";
    } else if (d.getRawData().contains("SN")) {
      wCode = "SN";
    } else if (d.getRawData().contains("-SN")) {
      wCode = "-SN";
    } else if (d.getRawData().contains("+RA")) {
      wCode = "+RA";
    } else if (d.getRawData().contains("-RA")) {
      wCode = "-RA";
    } else if (d.getRawData().contains("RA")) {
      wCode = "RA";
    } else if (d.getRawData().contains("VV")) {
      wCode = "VV";
    } else if (d.getRawData().contains("OVC")) {
      wCode = "OVC";
    } else if (d.getRawData().contains("BKN")) {
      wCode = "BKN";
    } else if (d.getRawData().contains("SCT")) {
      wCode = "SCT";
    } else if (d.getRawData().contains("FEW")) {
      wCode = "FEW";
    } else if (d.getRawData().contains("NSC")) {
      wCode = "NSC";
    } else if (d.getRawData().contains("CLR")) {
      wCode = "CLR";
    } 

    if (TextUtils.isEmpty(wCode)) {
      wCode = "CLR";
    }
    weather = SearchActivity.conditions.get(wCode);
    severity = SearchActivity.severity.get(wCode);
    if (d.getRawData().contains("MPS")) {
      int index = d.getRawData().indexOf("MPS");
      String wind = d.getRawData().substring(index - 2, index);
      int s = Integer.parseInt(wind);
      if (s == 0) {
        //no wind does not affect results
      } else if (s &lt; 3) {
        weather += ", Light wind";
      } else if (s &lt; 10) {
        weather += ", Windy";
        if (severity &lt; 1) severity = 1;
      } else {
        weather += ", Strong wind";
        if (severity &lt; 1) severity = 2;
      }
    }
    d.setGeneraWeather(weather);
    d.setWeatherSeverity(severity);
    return d;
  }


where conditions and severity is static public hashmaps

  private void generateWeatherMap() {
    conditions.clear();
    severity.clear();

    //Strings
    conditions.put("FG", "Fog");
    conditions.put("+SN", "Heavy snow");
    conditions.put("SN", "Snow");
    conditions.put("-SN", "Light snow");
    conditions.put("+RA", "Heavy rain");
    conditions.put("RA", "Rain");
    conditions.put("-RA", "Light rain");
    conditions.put("CLR", "Clear sky");
    conditions.put("NSC", "Little clouds");
    conditions.put("FEW", "Few clouds");
    conditions.put("SCT", "Scattered clouds");
    conditions.put("BKN", "Broken clouds");
    conditions.put("OVC", "Overcast");
    conditions.put("VV", "Heavy precipitation");
    //Values
    severity.put("FG", 2);
    severity.put("+SN", 2);
    severity.put("SN", 1);
    severity.put("-SN", 1);
    severity.put("+RA", 1);
    severity.put("RA", 1);
    severity.put("-RA", 1);
    severity.put("CLR", 0);
    severity.put("NSC", 0);
    severity.put("FEW", 0);
    severity.put("SCT", 1);
    severity.put("BKN", 1);
    severity.put("OVC", 2);
    severity.put("VV", 2);
  }
A question before

It is not clear to me how yor code works, but could as I'm not an expert of this METAR format. 

The weather you find is just the last you get from the input string.

If you have, for example, an Heavy show you will miss it as you could even have a Overcast.

This part is much a question, than an answer, sorry.

Assuming your code is correct and the input string contains only one weather condition, here are my considerations.

Advise 1

You should use a for loop with the keys of SearchActivity.conditions, and break as soon as you find the conditions, avoiding matching all others.

So for example:

String weather = SearchActivity.conditions.get("CLR");

for (String condition : SearchActivity.conditions.keySet()) {
   if (d.getRawData().contains(condition)) {
       weather = SearchActivity.conditions.get(condition);
       break;
   }
}


Of course if you really need the last match, than you could not use this loop, as the Set don't preserve the order of the keys.

In this case, if you still want to have a loop, you should create an array with the conditions keys.

Advise 2

You should use constant for the condition labels:

final String CLR = "CLR";
final String FOG = "Fog";
... so on...


And use those constants in your code.

EDIT

For example in your if else:

if (d.getRawData().contains(FOG)) {
    wCode = FOG;
} else if (...
} else {
    wCode = CLR;
}


A review on the code

Your if else statement is not correct, as the last check could be just an else:

....
} else if (d.getRawData().contains("NSC")) {
  wCode = "NSC";
} else {
  wCode = "CLR";
}


As after you check if the wCode variable is empty and the you force CLR, that is the last condition.

if (TextUtils.isEmpty(wCode)) {
  wCode = "CLR";
}