public static SortedMap<Short, List<Container>> groupByKey(RoaringBitmap... bitmaps) {
    Map<Short, List<Container>> grouped = new HashMap<>();
    for (RoaringBitmap bitmap : bitmaps) {
      RoaringArray ra = bitmap.highLowContainer;
      for (int i = 0; i < ra.size; ++i) {
        Container container = ra.values[i];
        Short key = ra.keys[i];
        List<Container> slice = grouped.get(key);
        if (null == slice) {
          slice = new ArrayList<>();
          grouped.put(key, slice);
        }
        slice.add(container);
      }
    }
    SortedMap<Short, List<Container>> sorted = new TreeMap<>(Util::compareUnsigned);
    sorted.putAll(grouped);
    return sorted;
  }
public static SortedMap < Short , List < Container > > groupByKey ( RoaringBitmap ... bitmaps ) { Map < Short , List < Container > > grouped = new HashMap < > ( ) ; for ( RoaringBitmap bitmap : bitmaps ) { RoaringArray ra = bitmap . highLowContainer ; for ( int i = 0 ; i < ra . size ; ++ i ) { Container container = ra . values [ i ] ; Short key = ra . keys [ i ] ; List < Container > slice = grouped . get ( key ) ; if ( null == slice ) { slice = new ArrayList < > ( ) ; grouped . put ( key , slice ) ; } slice . add ( container ) ; } } SortedMap < Short , List < Container > > sorted = new TreeMap < > ( Util :: compareUnsigned ) ; sorted . putAll ( grouped ) ; return sorted ; }
Groups the containers by their keys
@param bitmaps input bitmaps
@return The containers from the bitmaps grouped by key