code: public static FlatDataCollection mode(FlatDataCollection flatDataCollection) {
          AssociativeArray frequencies = frequencies(flatDataCollection);
          
          int maxCounter=0;
          
          FlatDataList modeList = new FlatDataList();
          
          for(Map.Entry<Object, Object> entry : frequencies.entrySet()) {
              Object key = entry.getKey();
              int count = ((Number)entry.getValue()).intValue();
              if(maxCounter==count) {
                  modeList.add(key);
              }
              else if(maxCounter<count) {
                  maxCounter=count;
                  modeList.clear();
                  modeList.add(key);
              }
          }
          
          return modeList.toFlatDataCollection();
      }
docs: Calculates the modes (more than one if found).
  
  @param flatDataCollection
  @return