Skip to content
Related Articles

Related Articles

Improve Article

DoubleSummaryStatistics accept() method in Java with Examples

  • Last Updated : 28 Jun, 2019
Geek Week

The accept() method of DoubleSummaryStatistics class in Java is used to accept the given value into this summary information.


public void accept(double value)

Parameter: This method accepts value as parameter that is to be recorded into this DoubleSummaryStatistics.

Return Value: This method do not returns anything.


// Java program to demonstrate
// the above method
import java.util.*;
public class DoubleSummaryStatisticsDemo {
    public static void main(String[] args)
        DoubleSummaryStatistics doubleSummaryStatistics
            = new DoubleSummaryStatistics();
        List<Double> list = new LinkedList<>();
        Iterator<Double> iterator = list.listIterator();
        while (iterator.hasNext()) {
            // Add the doubles to the
            // DoubleSummaryStatistics object
        double value = 34.45;
        System.out.println("Inserting " + value
                           + " using accept() ");

Inserting 34.45 using accept()
DoubleSummaryStatistics{count=11, sum=104717.403700, min=0.000000, average=9519.763973, max=45664.700000}


Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :