title: Java 8 is not maintaining the order while grouping
body: <p>I m using Java 8 for grouping by data. But results obtained are not in order formed.</p>
  
  <pre><code>Map&lt;GroupingKey, List&lt;Object&gt;&gt; groupedResult = null;
  
          if (!CollectionUtils.isEmpty(groupByColumns)) {
  
              Map&lt;String, Object&gt; mapArr[] = new LinkedHashMap[mapList.size()];
  
              if (!CollectionUtils.isEmpty(mapList)) {
                  int count = 0;
                  for (LinkedHashMap&lt;String, Object&gt; map : mapList) {
                      mapArr[count++] = map;
                  }
              }
              Stream&lt;Map&lt;String, Object&gt;&gt; people = Stream.of(mapArr);
              groupedResult = people
                      .collect(Collectors.groupingBy(p -&gt; new GroupingKey(p, groupByColumns), Collectors.mapping((Map&lt;String, Object&gt; p) -&gt; p, toList())));
  
  
  public static class GroupingKey 
  
          public GroupingKey(Map&lt;String, Object&gt; map, List&lt;String&gt; cols) {
  
              keys = new ArrayList&lt;&gt;();
  
              for (String col : cols) {
                  keys.add(map.get(col));
              }
          }
  
          // Add appropriate isEqual() ... you IDE should generate this
          @Override
          public boolean equals(Object obj) {
              if (obj == null) {
                  return false;
              }
              if (getClass() != obj.getClass()) {
                  return false;
              }
              final GroupingKey other = (GroupingKey) obj;
              if (!Objects.equals(this.keys, other.keys)) {
                  return false;
              }
              return true;
          }
  
          @Override
          public int hashCode() {
              int hash = 7;
              hash = 37 * hash + Objects.hashCode(this.keys);
              return hash;
          }
  
          @Override
          public String toString() {
              return keys + "";
          }
  
          public ArrayList&lt;Object&gt; getKeys() {
              return keys;
          }
  
          public void setKeys(ArrayList&lt;Object&gt; keys) {
              this.keys = keys;
          }
  
      }
  </code></pre>
  
  <p>Here i am using my class groupingKey by which i m dynamically passing from ux. How can get this groupByColumns in sorted form?</p>