VOOZH about

URL: https://www.geeksforgeeks.org/java/java-guava-booleans-counttrue-method-with-examples/

⇱ Java Guava | Booleans.countTrue() method with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Java Guava | Booleans.countTrue() method with Examples

Last Updated : 11 Jul, 2025
The countTrue() method of Booleans Class in Guava Library is used to count the number of values that are true in the specified boolean values passed as the parameter. Syntax:
public static int countTrue(boolean... values)
Parameters: This method accepts the boolean values among which the true values are to be count. Return values: This method returns an integer value which is the count of values that are true. Example-1 :
Output:
3
Example 2 :
Comment