public class BoundedCount extends Object
getCount()
elements. A count marked as exact has exactly count elements (see isExact()
. This allows APIs to give
indications of collection size without committing to expensive operations when an exact count requires
significant work.
Provided are some example scenarios and what the results mean:
Modifier and Type  Method and Description 

static BoundedCount 
atLeast(long count)
Create a BoundedCount that is atleast as big as a given number.

boolean 
equals(Object o) 
static BoundedCount 
exactly(long count)
Create a bounded count that exactly represents a number.

static BoundedCount 
fromCountedItemsAndLimit(long count,
long potentialMaxCount)
Get a bounded count from counting up to an upper bound.

long 
getCount()
The number of elements counted in a collection.

int 
hashCode() 
boolean 
isExact() 
String 
toString() 
public static BoundedCount exactly(long count)
count
 The exact count that this represents; not a bounded number.public static BoundedCount atLeast(long count)
count
 A number that is atleast as big as the real count of elements in a collection.public static BoundedCount fromCountedItemsAndLimit(long count, long potentialMaxCount)
count
 The number of elements that were actually counted.potentialMaxCount
 The maximum number of elements that we counted up to.public long getCount()
isExact()
returns true then it returns the exact size of the collection. Otherwise it
returns a lower bound of the size of the collection. The answer will always be nonnegative.public boolean isExact()
getCount()
is known to be the exact number of elements in the collection. It will return
False if this count represents a lower bound.Copyright © 2020 Atlassian. All rights reserved.