Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mockito.internal.util.collections
Class HashCodeAndEqualsSafeSet

    java.lang.Object
      org.mockito.internal.util.collections.HashCodeAndEqualsSafeSet

All Implemented Interfaces:
  java.lang.Iterable<java.lang.Object>, java.util.Collection<java.lang.Object>, java.util.Set<java.lang.Object>

    public class HashCodeAndEqualsSafeSet

extends java.lang.Object
implements java.util.Set<java.lang.Object>

hashCode and equals safe hash based set.

Useful for holding mocks that have un-stubbable hashCode or equals method, meaning that in this scenario the real code is always called and will most probably cause an `NullPointerException`.

This collection wraps the mock in an augmented type `HashCodeAndEqualsMockWrapper` that have his own implementation.

See Also:
  `HashCodeAndEqualsMockWrapper`

Constructor Summary
`HashCodeAndEqualsSafeSet()`

Method Summary
`boolean` | `add(java.lang.Object mock)`
`boolean` | `addAll(java.util.Collection<?> mocks)`
`void` | `clear()`
`java.lang.Object` | `clone()`
`boolean` | `contains(java.lang.Object mock)`
`boolean` | `containsAll(java.util.Collection<?> mocks)`
`boolean` | `equals(java.lang.Object o)`
`int` | `hashCode()`
`boolean` | `isEmpty()`
`java.util.Iterator<java.lang.Object>` | `iterator()`
`static HashCodeAndEqualsSafeSet` | `of(java.lang.Iterable<java.lang.Object> objects)`
`static HashCodeAndEqualsSafeSet` | `of(java.lang.Object... mocks)`
`boolean` | `remove(java.lang.Object mock)`
`boolean` | `removeAll(java.util.Collection<?> mocks)`
`boolean` | `retainAll(java.util.Collection<?> mocks)`
`int` | `size()`
`java.lang.Object[]` | `toArray()`
`
`<T> T[]`
` | `toArray(T[] typedArray)`
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### HashCodeAndEqualsSafeSet

    public HashCodeAndEqualsSafeSet()

Method Detail

### iterator

    public java.util.Iterator<java.lang.Object> iterator()

  Specified by:
    `iterator` in interface `java.lang.Iterable<java.lang.Object>`
  Specified by:
    `iterator` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `iterator` in interface `java.util.Set<java.lang.Object>`

### size

    public int size()

  Specified by:
    `size` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `size` in interface `java.util.Set<java.lang.Object>`

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `isEmpty` in interface `java.util.Set<java.lang.Object>`

### contains

    public boolean contains(java.lang.Object mock)

  Specified by:
    `contains` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `contains` in interface `java.util.Set<java.lang.Object>`

### add

    public boolean add(java.lang.Object mock)

  Specified by:
    `add` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `add` in interface `java.util.Set<java.lang.Object>`

### remove

    public boolean remove(java.lang.Object mock)

  Specified by:
    `remove` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `remove` in interface `java.util.Set<java.lang.Object>`

### clear

    public void clear()

  Specified by:
    `clear` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `clear` in interface `java.util.Set<java.lang.Object>`

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Overrides:
    `clone` in class `java.lang.Object`
  Throws:
    `java.lang.CloneNotSupportedException`

### equals

    public boolean equals(java.lang.Object o)

  Specified by:
    `equals` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `equals` in interface `java.util.Set<java.lang.Object>`
  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `hashCode` in interface `java.util.Set<java.lang.Object>`
  Overrides:
    `hashCode` in class `java.lang.Object`

### toArray

    public java.lang.Object[] toArray()

  Specified by:
    `toArray` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `toArray` in interface `java.util.Set<java.lang.Object>`

### toArray

    public <T> T[] toArray(T[] typedArray)

  Specified by:
    `toArray` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `toArray` in interface `java.util.Set<java.lang.Object>`

### removeAll

    public boolean removeAll(java.util.Collection<?> mocks)

  Specified by:
    `removeAll` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `removeAll` in interface `java.util.Set<java.lang.Object>`

### containsAll

    public boolean containsAll(java.util.Collection<?> mocks)

  Specified by:
    `containsAll` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `containsAll` in interface `java.util.Set<java.lang.Object>`

### addAll

    public boolean addAll(java.util.Collection<?> mocks)

  Specified by:
    `addAll` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `addAll` in interface `java.util.Set<java.lang.Object>`

### retainAll

    public boolean retainAll(java.util.Collection<?> mocks)

  Specified by:
    `retainAll` in interface `java.util.Collection<java.lang.Object>`
  Specified by:
    `retainAll` in interface `java.util.Set<java.lang.Object>`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### of

    public static HashCodeAndEqualsSafeSet of(java.lang.Object... mocks)

### of

    public static HashCodeAndEqualsSafeSet of(java.lang.Iterable<java.lang.Object> objects)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD