title: Program to calculate MIN, MAX of array of elements where each element is of Map<String,Float>
body: <p>I have a array of elements where each element is of Map type</p>
  
  <pre><code>elements = [{"a":10,"b":12,"c":13,"d":14},{"a":2,"b":1,"c":5,"d":19},{"a":5,"b":4,"c":13,"d":4},{"a":140,"b":1,"c":4,"d":14}]
  </code></pre>
  
  <p>I want to find min max of Map Keys.</p>
  
  <pre><code>[{a "min": 2, "max": 140},{b "min": 1, "max": 5},{c "min": 4, "max": 13},{d "min": 4, "max": 19}]
  </code></pre>
  
  <p>My Approch is</p>
  
  <pre><code>    public class TestMap {
  
      public static void main(String[] args) {
  
  ArrayList&lt;Map&lt;String, Float&gt;&gt; elements = new ArrayList&lt;Map&lt;String, Float&gt;&gt;();
  System.out.println("Initial Mappings are: " + elements);
  
  ArrayList&lt;Float&gt; A = new ArrayList&lt;Float&gt;();
  ArrayList&lt;Float&gt; B = new ArrayList&lt;Float&gt;();
  ArrayList&lt;Float&gt; C = new ArrayList&lt;Float&gt;();
  ArrayList&lt;Float&gt; D = new ArrayList&lt;Float&gt;();
  
  for (int i = 0; i &lt; 3; i++) {
  
  Map&lt;String, Float&gt; elem = (Map&lt;String, Float&gt;) elements.get(i);
  
  A.add(elem.get("a"));
  B.add(elem.get("b"));
  C.add(elem.get("c"));
  D.add(elem.get("d"));
  }     
  </code></pre>
  
  <p>I have the written function to find Min and Max and call in the function</p>
  
  <pre><code> System.out.println("A -&gt;" + "Min: " + findMin(A) + " Max: " + findMax(A));
     System.out.println("B -&gt;" + "Min: " + findMin(B) + " Max: " + findMax(B));
     System.out.println("C -&gt;" + "Min: " + findMin(C) + " Max: " + findMax(C));
     System.out.println("D -&gt;" + "Min: " + findMin(D) + " Max: " + findMax(D));
  </code></pre>
  
  <p>}</p>
  
  <p>Is there any better way of doing this which is efficient.</p>