title: how to convert List<Map<Integer, Double>> peak to arrays?
body: <p>I'm using this hashmap in my project android.</p>
  
  <p>Using this command:</p>
  
  <pre><code>            List&lt;Map&lt;Integer, Double&gt;&gt; peak = PeakDetect.peak_detection(test1,delta, indices);
  </code></pre>
  
  <p>where test1 is:</p>
  
  <pre><code>double [] test1= {16 ,1, 2, -20, 3, 12, 2, 1, 0, -1, -2 ,-3, -6, -3, -2 ,-1, 0};
  </code></pre>
  
  <p>I have this result:</p>
  
  <pre><code>Result: [{0=0.14692041925343213, 5=0.28567859299278475}, {3=0.4244367667321373}]
  </code></pre>
  
  <p>I woud to store in a new array the first index, in that example: </p>
  
  <pre><code>0 and 5
  </code></pre>
  
  <p>0 and 5 represent maxima index of test1, 3 represent minima index of test1.</p>
  
  <p>How could I do that? thanks in Advance</p>
  
  <p><strong>edit</strong>
  Here peak_detector.java:</p>
  
  <pre><code>package com.google.android.gms.samples.vision.face.rPPG;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.HashMap;
  import java.util.Map;
  
  public class PeakDetect {
  
          public static &lt;U&gt; List&lt;Map&lt;U, Double&gt;&gt; peak_detection(List&lt;Double&gt; values, Double delta, List&lt;U&gt; indices)
          {
              assert(indices != null);
              assert(values.size() != indices.size());
  
              Map&lt;U, Double&gt; maxima = new HashMap&lt;U, Double&gt;();
              Map&lt;U, Double&gt; minima = new HashMap&lt;U, Double&gt;();
              List&lt;Map&lt;U, Double&gt;&gt; peaks = new ArrayList&lt;Map&lt;U, Double&gt;&gt;();
              peaks.add(maxima);
              peaks.add(minima);
  
              Double maximum = 0.0;
              Double minimum = 0.0;
              U maximumPos = null;
              U minimumPos = null;
  
              boolean lookForMax = true;
  
              Integer pos = 0;
              for (Double value : values) {
                  if (value &gt; maximum || maximum == null) {
                      maximum = value;
                      maximumPos = indices.get(pos);
                  }
  
                  if (value &lt; minimum || minimum == null) {
                      minimum = value;
                      minimumPos = indices.get(pos);
                  }
  
                  if (lookForMax) {
                      if (value &lt; maximum - delta) {
                          maxima.put(maximumPos, value);
                          minimum = value;
                          minimumPos = indices.get(pos);
                          lookForMax = false;
                      }
                  } else {
                      if (value &gt; minimum + delta) {
                          minima.put(minimumPos, value);
                          maximum = value;
                          maximumPos = indices.get(pos);
                          lookForMax = true;
                      }
                  }
  
                  pos++;
              }
  
              return peaks;
          }
  
  
  }
  </code></pre>