Class jgl.Counting
All Packages Class Hierarchy This Package Previous Next Index
Class jgl.Counting
java.lang.Object
|
+----jgl.Counting
- public final class Counting
- extends Object
The Counting class contains generic counting algorithms.
- See Also:
- CountingExamples
-
count(Container, Object)
- Return the number of elements in a container that match a particular object using
equals().
-
count(InputIterator, InputIterator, Object)
- Return the number of elements in a range that match a particular object using
equals().
-
countIf(Container, UnaryPredicate)
- Return the number of elements in a container that satisfy a predicate.
-
countIf(InputIterator, InputIterator, UnaryPredicate)
- Return the number of elements in a range that satisfy a predicate.
count
public static int count(InputIterator first,
InputIterator last,
Object object)
- Return the number of elements in a range that match a particular object using
equals(). The time complexity is linear and the space complexity is constant.
- Parameters:
- first - An iterator positioned at the first element in the range.
- last - An iterator positioned immediately after the last element in the range.
- object - The object to count.
- Returns:
- The number of objects that matched.
count
public static int count(Container container,
Object object)
- Return the number of elements in a container that match a particular object using
equals(). The time complexity is linear and the space complexity is constant.
- Parameters:
- container - The container.
- object - The object to count.
- Returns:
- The number of objects that matched.
countIf
public static int countIf(InputIterator first,
InputIterator last,
UnaryPredicate predicate)
- Return the number of elements in a range that satisfy a predicate.
The time complexity is linear and the space complexity is constant.
- Parameters:
- first - An iterator positioned at the first element in the range.
- last - An iterator positioned immediately after the last element in the range.
- predicate - A unary predicate.
- Returns:
- The number of objects that matched.
countIf
public static int countIf(Container container,
UnaryPredicate predicate)
- Return the number of elements in a container that satisfy a predicate.
The time complexity is linear and the space complexity is constant.
- Parameters:
- first - An iterator positioned at the first element in the range.
- last - An iterator positioned immediately after the last element in the range.
- predicate - A unary predicate.
- Returns:
- The number of objects that matched.
All Packages Class Hierarchy This Package Previous Next Index