org/hamcrest/FeatureMatcher.html#matchesSafely\(T,
org.hamcrest.Description\)) `  
**Methods inherited from class org.hamcrest.[ TypeSafeDiagnosingMatcher
](../../../org/hamcrest/TypeSafeDiagnosingMatcher.html "class in
org.hamcrest") **  
---  
` [ describeMismatch
](../../../org/hamcrest/TypeSafeDiagnosingMatcher.html#describeMismatch\(java.lang.Object,
org.hamcrest.Description\)) , [ matches
](../../../org/hamcrest/TypeSafeDiagnosingMatcher.html#matches\(java.lang.Object\))
`  
**Methods inherited from class org.hamcrest.[ BaseMatcher
](../../../org/hamcrest/BaseMatcher.html "class in org.hamcrest") **  
---  
` [ _dont_implement_Matcher___instead_extend_BaseMatcher_
](../../../org/hamcrest/BaseMatcher.html#_dont_implement_Matcher___instead_extend_BaseMatcher_\(\))
, [ toString ](../../../org/hamcrest/BaseMatcher.html#toString\(\)) `  
**Methods inherited from class java.lang.Object**  
---  
` clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait,
wait `  
  
**Constructor Detail**  
---  
  
###  IsCollectionWithSize

    
    
    public **IsCollectionWithSize**([Matcher](../../../org/hamcrest/Matcher.html "interface in org.hamcrest")<? super java.lang.Integer> sizeMatcher)

**Method Detail**  
---  
  
###  featureValueOf

    
    
    protected java.lang.Integer **featureValueOf**(java.util.Collection<? extends [E](../../../org/hamcrest/collection/IsCollectionWithSize.html "type parameter in IsCollectionWithSize")> actual)

     **Description copied from class:` [ FeatureMatcher ](../../../org/hamcrest/FeatureMatcher.html#featureValueOf\(T\)) ` **
     Implement this to extract the interesting feature. 

    

**Specified by:**      ` [ featureValueOf
](../../../org/hamcrest/FeatureMatcher.html#featureValueOf\(T\)) ` in class `
[ FeatureMatcher ](../../../org/hamcrest/FeatureMatcher.html "class in
org.hamcrest") <java.util.Collection<? extends [ E
](../../../org/hamcrest/collection/IsCollectionWithSize.html "type parameter
in IsCollectionWithSize") >,java.lang.Integer> `

    

**Parameters:**      ` actual ` \- the target object  **Returns:**      the
feature to be matched

* * *

###  hasSize

    
    
    public static <E> [Matcher](../../../org/hamcrest/Matcher.html "interface in org.hamcrest")<java.util.Collection<? extends E>> **hasSize**([Matcher](../../../org/hamcrest/Matcher.html "interface in org.hamcrest")<? super java.lang.Integer> sizeMatcher)

     Creates a matcher for ` Collection ` s that matches when the ` size() ` method returns a value that satisfies the specified matcher. 

For example:

    
    
    assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))

    

**Parameters:**      ` sizeMatcher ` \- a matcher for the size of an examined
` Collection `

* * *

###  hasSize

    
    
    public static <E> [Matcher](../../../org/hamcrest/Matcher.html "interface in org.hamcrest")<java.util.Collection<? extends E>> **hasSize**(int size)

     Creates a matcher for ` Collection ` s that matches when the ` size() ` method returns a value equal to the specified ` size ` . 

For example:

    
    
    assertThat(Arrays.asList("foo", "bar"), hasSize(2))

    

**Parameters:**      ` size ` \- the expected size of an examined ` Collection
`

* * *

|  [ **Overview** ](../../../overview-summary.html) |  [ **Package** ](package-summary.html) |  **Class** |  [ **Use** ](class-use/IsCollectionWithSize.html) |  [ **Tree** ](package-tree.html) |  [ **Deprecated** ](../../../deprecated-list.html) |  [ **Index** ](../../../index-all.html) |  [ **Help** ](../../../help-doc.html)  
---|---|---|---|---|---|---|---  
__  
[ **PREV CLASS** ](../../../org/hamcrest/collection/IsArrayWithSize.html "class in org.hamcrest.collection") [ **NEXT CLASS** ](../../../org/hamcrest/collection/IsEmptyCollection.html "class in org.hamcrest.collection") |  [ **FRAMES** ](../../../index.html?org/hamcrest/collection/IsCollectionWithSize.html) [ **NO FRAMES** ](IsCollectionWithSize.html) [ **All Classes** ]