code: public static double median(FlatDataCollection flatDataCollection) {
          double[] doubleArray = flatDataCollection.stream().filter(x -> x!=null).mapToDouble(TypeInference::toDouble).toArray();
          int n = doubleArray.length;
          if(n==0) {
              throw new IllegalArgumentException("The provided collection can't be empty.");
          }
          Arrays.sort(doubleArray);
          
          double median;
          if(n%2==0) {
              median = (doubleArray[n/2 - 1] + doubleArray[n/2])/2.0;
          }
          else {
              median = doubleArray[n/2];
          }
          
          return median;
      }
docs: Calculates the median.
  
  @param flatDataCollection
  @return