@Test public void testCalculateMean_Collection() { try { Statistics.calculateMean((Collection<Number>) null); fail("IllegalArgumentException should have been thrown on null key"); } catch (IllegalArgumentException e) { assertEquals("Null 'values' argument.", e.getMessage()); } try { Statistics.calculateMean((Collection<Number>) null, false); fail("IllegalArgumentException should have been thrown on null key"); } catch (IllegalArgumentException e) { assertEquals("Null 'values' argument.", e.getMessage()); } List<Number> values = new ArrayList<Number>(); assertTrue(Double.isNaN(Statistics.calculateMean(values))); assertTrue(Double.isNaN(Statistics.calculateMean(values, true))); assertTrue(Double.isNaN(Statistics.calculateMean(values, false))); values.add(9.0); assertEquals(9.0, Statistics.calculateMean(values), EPSILON); assertEquals(9.0, Statistics.calculateMean(values, true), EPSILON); assertEquals(9.0, Statistics.calculateMean(values, false), EPSILON); values.add(null); assertTrue(Double.isNaN(Statistics.calculateMean(values))); assertTrue(Double.isNaN(Statistics.calculateMean(values, true))); assertEquals(9.0, Statistics.calculateMean(values, false), EPSILON); values.clear(); values.add(9.0); values.add(Double.NaN); assertTrue(Double.isNaN(Statistics.calculateMean(values))); assertTrue(Double.isNaN(Statistics.calculateMean(values, true))); assertEquals(9.0, Statistics.calculateMean(values, false), EPSILON); values = new ArrayList<Number>(); values.add(9.0); values.add(3.0); values.add(2.0); values.add(2.0); double mean = Statistics.calculateMean(values); assertEquals(4.0, mean, EPSILON); values.add(Double.NaN); assertTrue(Double.isNaN(Statistics.calculateMean(values))); }
public static double calculateMean(Number[] values) { return calculateMean(values, true); }
Statistics { public static double calculateMean(Number[] values) { return calculateMean(values, true); } }
Statistics { public static double calculateMean(Number[] values) { return calculateMean(values, true); }  }
Statistics { public static double calculateMean(Number[] values) { return calculateMean(values, true); }  static double calculateMean(Number[] values); static double calculateMean(Number[] values,
            boolean includeNullAndNaN); static double calculateMean(Collection<Number> values); static double calculateMean(Collection<Number> values,
            boolean includeNullAndNaN); static double calculateMedian(List<Number> values); static double calculateMedian(List<Number> values,
            boolean copyAndSort); static double calculateMedian(List<Number> values, int start, int end); static double calculateMedian(List<Number> values,
            int start, int end, boolean copyAndSort); static double getStdDev(Number[] data); static double[] getLinearFit(Number[] xData, Number[] yData); static double getSlope(Number[] xData, Number[] yData); static double getCorrelation(Number[] data1, Number[] data2); static double[][] getMovingAverage(Number[] xData,
                                              Number[] yData,
                                              int period); }
Statistics { public static double calculateMean(Number[] values) { return calculateMean(values, true); }  static double calculateMean(Number[] values); static double calculateMean(Number[] values,
            boolean includeNullAndNaN); static double calculateMean(Collection<Number> values); static double calculateMean(Collection<Number> values,
            boolean includeNullAndNaN); static double calculateMedian(List<Number> values); static double calculateMedian(List<Number> values,
            boolean copyAndSort); static double calculateMedian(List<Number> values, int start, int end); static double calculateMedian(List<Number> values,
            int start, int end, boolean copyAndSort); static double getStdDev(Number[] data); static double[] getLinearFit(Number[] xData, Number[] yData); static double getSlope(Number[] xData, Number[] yData); static double getCorrelation(Number[] data1, Number[] data2); static double[][] getMovingAverage(Number[] xData,
                                              Number[] yData,
                                              int period);  }