Java Spliterator getExactSizeIfKnown() MethodLast Updated : 17 Mar 2025 The getExactSizeIfKnown() method of Java Interface Spliterator is used to get an estimateSize() of the SIZED spliterator, otherwise returns -1. SyntaxFollowing is the declaration of getExactSizeIfKnown() method- ParameterThis method does not accept any parameter. ReturnThe getExactSizeIfKnown() method returns the estimateSize() of the spliterator, if known, otherwise returns -1. ExceptionsNA Compatibility VersionJava 1.8 and above Example 1Output: Estimate size: 4 Exact size: 4 Elements of arraylist-- 1001 -2001 3001 -4001 Example 2Output: Exact size before getting List elements: 3 Rahul Nikki Prem Exact size after getting List elements: 0 |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India