Skip to content
Related Articles
Open in App
Not now

Related Articles

DoubleSummaryStatistics accept() method in Java with Examples

Improve Article
Save Article
  • Last Updated : 28 Jun, 2019
Improve Article
Save Article

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}


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!