title: How to Remove newline characters from List<String>
body: <p>I've got method which returns me a Map from an XML file. I've converted that map to separate Keys and Values into List. </p>
  
  <p>However I'm noticing there are newline characters in the values list. How can I strip out the newline and replace them with a space or leave them blank. </p>
  
  <p>Code:</p>
  
  <pre><code>@Test
  public void testGetXMLModelData() throws Exception {
      File f = new File("xmlDir/example.xml");
      Model m = getXMLModelData(f);
  
      logger.debug("Models Keys: "+m.getInputs());
      logger.debug("Models Values: "+m.getValues());
  }
  
  public Model getXMLModelData(File f) throws Exception { 
  
      Model model = new Model();
  
      Map&lt;String,String&gt; map = p(f);
      List&lt;String&gt; listKeys = new ArrayList&lt;String&gt;(map.keySet());
      List&lt;String&gt; listValues = new ArrayList&lt;String&gt;(map.values());
  
      model.setInputs(listKeys);
      model.setValues(listValues); 
  
      return model;
  }
  
  
  public Map&lt;String, String&gt; p(File file) throws Exception {
  
      Map&lt;String, String&gt; map = new HashMap&lt;String,String&gt;();
      XMLStreamReader xr = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(file));
  
      while(xr.hasNext()) {
  
          int e = xr.next();
          if (e == XMLStreamReader.START_ELEMENT) {
              String name = xr.getLocalName();
              xr.next();
              String value = null;
              try {
                  value = xr.getText();
              } catch (IllegalStateException exep) {
                  exep.printStackTrace();
              }
              map.put(name, value);
          } 
      }
      return map;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>2015-08-19 20:13:52,327 : Models Keys: [IRS1095A, MonthlyPlanPremiumAmtPP, WagesSalariesAndTipsAmt, MonthlyAdvancedPTCAmtPP, MonthCdPP, ReturnData, IndividualReturnFilingStatusCd, PrimaryResidentStatesInfoGrpPP, MonthlyPTCInformationGrpPP, IRS1040, ResidentStateInfoPP, SelfSelectPINGrp, MonthlyPremiumSLCSPAmtPP, Filer, ResidentStateAbbreviationCdPP, PrimaryBirthDt, Return, ReturnHeader, TotalExemptionsCnt, AdjustedGrossIncomeAmt, PrimarySSN]
  2015-08-19 20:13:52,328 : Models Values: [
        , 136, 22000, 125, SEPTEMBER, 
      , 1, 
          , 
          , 
        , 
            , 
        , 250, 
        , CA, 1970-01-01, 
    , 
      , 1, 22000, 555-11-2222]
  </code></pre>
  
  <p>Any help or assistance would be much appreciated. Thanks in advance</p>
  
  <p>Edit:</p>
  
  <p>XML file</p>
  
  <pre><code>&lt;Return xmlns="http://www.irs.gov/efile"&gt;
    &lt;ReturnData&gt;
      &lt;IRS1095A uuid="a77f40a2-af31-4404-a27d-4c1eaad730c2"&gt;
        &lt;MonthlyPTCInformationGrpPP uuid="69dc9dd5-5415-4ee4-a199-19b2dbb701be"&gt;
          &lt;MonthlyPlanPremiumAmtPP&gt;136&lt;/MonthlyPlanPremiumAmtPP&gt;
          &lt;MonthlyAdvancedPTCAmtPP&gt;125&lt;/MonthlyAdvancedPTCAmtPP&gt;
          &lt;MonthCdPP&gt;SEPTEMBER&lt;/MonthCdPP&gt;
          &lt;MonthlyPremiumSLCSPAmtPP&gt;250&lt;/MonthlyPremiumSLCSPAmtPP&gt;
        &lt;/MonthlyPTCInformationGrpPP&gt;
      &lt;/IRS1095A&gt;
      &lt;IRS1040&gt;
        &lt;IndividualReturnFilingStatusCd&gt;1&lt;/IndividualReturnFilingStatusCd&gt;
        &lt;WagesSalariesAndTipsAmt&gt;22000&lt;/WagesSalariesAndTipsAmt&gt;
        &lt;TotalExemptionsCnt&gt;1&lt;/TotalExemptionsCnt&gt;
        &lt;AdjustedGrossIncomeAmt&gt;22000&lt;/AdjustedGrossIncomeAmt&gt;
      &lt;/IRS1040&gt;
    &lt;/ReturnData&gt;
    &lt;ReturnHeader&gt;
      &lt;SelfSelectPINGrp&gt;
        &lt;PrimaryBirthDt&gt;1970-01-01&lt;/PrimaryBirthDt&gt;
      &lt;/SelfSelectPINGrp&gt;
      &lt;Filer&gt;
        &lt;PrimarySSN&gt;555-11-2222&lt;/PrimarySSN&gt;
        &lt;PrimaryResidentStatesInfoGrpPP&gt;
          &lt;ResidentStateInfoPP uuid="a77f40a2-af31-4404-a27d-4c1eaad730c2"&gt;
            &lt;ResidentStateAbbreviationCdPP&gt;CA&lt;/ResidentStateAbbreviationCdPP&gt;
          &lt;/ResidentStateInfoPP&gt;
        &lt;/PrimaryResidentStatesInfoGrpPP&gt;
      &lt;/Filer&gt;
    &lt;/ReturnHeader&gt;
  &lt;/Return&gt;
  </code></pre>