title: Get next value on a map?
body: <p>I'm trying to compare element to next element in a collection.</p>
  
  <p>For example :</p>
  
  <pre><code>let array: [(Double, String)]= [(2.3, "ok"),
                                  (1.4, "ok"),
                                  (5.1, "notOk")]
  </code></pre>
  
  <p>I need a returned array who will summary element where the string is the same. So my result will be :</p>
  
  <pre><code>new array = [(3.7, "ok"), (5.1, "notOk")]
  </code></pre>
  
  <p>I need to do it functional if possible. i tried to get next element in a map but can't found how.</p>
  
  <p>Something like this (this is just for logic, this code isn't working.</p>
  
  <pre><code>let newArray = array.map {(element, nextElement) in 
      if element.1 == nextElement.1 {
          return element.0 + nextElement.0 
      }
  } 
  </code></pre>