MCPcopy Create free account
hub / github.com/TheAlgorithms/Java / checkIfNotEmpty

Method checkIfNotEmpty

src/main/java/com/thealgorithms/maths/Means.java:138–142  ·  view source on GitHub ↗

Validates that the input iterable is not empty. @param numbers the input numbers to validate @throws IllegalArgumentException if the input is empty

(final Iterable<Double> numbers)

Source from the content-addressed store, hash-verified

136 * @throws IllegalArgumentException if the input is empty
137 */
138 private static void checkIfNotEmpty(final Iterable<Double> numbers) {
139 if (!numbers.iterator().hasNext()) {
140 throw new IllegalArgumentException("Empty list given for Mean computation.");
141 }
142 }
143}

Callers 4

arithmeticMethod · 0.95
geometricMethod · 0.95
harmonicMethod · 0.95
quadraticMethod · 0.95

Calls 2

hasNextMethod · 0.45
iteratorMethod · 0.45

Tested by

no test coverage detected