LongSummaryStatistics accept(int) method in Java with Examples Last Updated : 27 Jun, 2019 Comments Improve Suggest changes Like Article Like Report The accept(int) method of LongSummaryStatistics class in Java is used to accept the given integer value into this summary information. Syntax: public void accept(int value) Parameter: This method accepts value as parameter that is to be recorded into this LongSummaryStatistics. Return Value: This method do not returns anything. Program: Java // Java program to demonstrate // the above method import java.util.*; public class LongSummaryStatisticsDemo { public static void main(String[] args) { LongSummaryStatistics longSummaryStatistics = new LongSummaryStatistics(); List<Integer> list = Arrays.asList(10, 20, 30, 40, 50); Iterator<Integer> iterator = list.listIterator(); while (iterator.hasNext()) { // Add the integers to the LongSummaryStatistics object longSummaryStatistics.accept(iterator.next()); } System.out.println(longSummaryStatistics.toString()); } } Output: LongSummaryStatistics{count=5, sum=150, min=10, average=30.000000, max=50} Reference: https://docs.oracle.com/javase/10/docs/api/java/util/LongSummaryStatistics.html#accept(int) Comment More infoAdvertise with us Next Article LongSummaryStatistics accept(int) method in Java with Examples S ShubhamMaurya3 Follow Improve Article Tags : Misc Java Java - util package Java-Functions Java-LongSummaryStatistics +1 More Practice Tags : JavaMisc Similar Reads LongSummaryStatistics accept(long) method in Java with Examples The accept(long) method of LongSummaryStatistics class in Java is used to accept the given long value into this summary information. Syntax: public void accept(long value) Parameter: This method accepts value as parameter that is to be recorded into this LongSummaryStatistics. Return Value: This met 1 min read LongSummaryStatistics getMin() method in Java with Examples The getMin() method of LongSummaryStatistics class in Java is used to get the minimum of records in this LongSummaryStatistics. Syntax: public int getMin() Parameter: This method do not accept any value as parameter. Return Value: This method returns the minimum of the records in this LongSummarySta 1 min read IntSummaryStatistics accept() method in Java with Examples The accept() method of IntSummaryStatistics class in Java is used to accept the given value into this summary information. Syntax: public void accept(int value) Parameter: This method accepts value as parameter that is to be recorded into this IntSummaryStatistics. Return Value: This method do not r 1 min read LongSummaryStatistics getCount() method in Java with Examples The getCount() method of LongSummaryStatistics class in Java is used to get the count of records in this LongSummaryStatistics. Syntax: public long getCount() Parameter: This method do not accept any value as parameter. Return Value: This method returns the count of the records in this LongSummarySt 1 min read LongSummaryStatistics getSum() method in Java with Examples The getSum() method of LongSummaryStatistics class in Java is used to get the sum of records in this LongSummaryStatistics. Syntax: public long getSum() Parameter: This method do not accept any value as parameter. Return Value: This method returns the sum of the records in this LongSummaryStatistics 1 min read LongSummaryStatistics getMax() method in Java with Examples The getMax() method of LongSummaryStatistics class in Java is used to get the maximum of records in this LongSummaryStatistics. Syntax: public int getMax() Parameter: This method do not accept any value as parameter. Return Value: This method returns the maximum of the records in this LongSummarySta 1 min read LongSummaryStatistics getAverage() method in Java with Examples The getAverage() method of LongSummaryStatistics class in Java is used to get the average of records in this LongSummaryStatistics. Syntax: public double getAverage() Parameter: This method do not accept any value as parameter. Return Value: This method returns the average of the records in this Lon 1 min read LongSummaryStatistics toString() method in Java with Examples The toString() method of LongSummaryStatistics class in Java is used to get the String representation of records in this LongSummaryStatistics. Syntax: public long toString() Parameter: This method do not accept any value as parameter. Return Value: This method returns the String representation of t 1 min read Java.util.LongSummaryStatistics class with Examples The LongSummaryStatistics class is present in java.util package. It takes a collection of Long objects and is useful in the circumstances when we are dealing with a stream of large integers. It maintains a count of the number of values it has processed, their sum and various other statistics. The cl 3 min read IntSummaryStatistics getMin() method in Java with Examples The getMin() method of IntSummaryStatistics class in Java is used to get the minimum of records in this IntSummaryStatistics. Syntax: public int getMin() Parameter: This method do not accept any value as parameter. Return Value: This method returns the minimum of the records in this IntSummaryStatis 1 min read Like