net.i2p.router.tunnel.pool

## Class ExcluderBase

- java.lang.Object
- - net.i2p.router.tunnel.pool.ExcluderBase

- All Implemented Interfaces:
    Iterable<Hash>, Collection<Hash>, Set<Hash>
  Direct Known Subclasses:
    TunnelPeerSelector.Excluder, TunnelPeerSelector.HopChainValidator

      abstract class ExcluderBase
      extends Object
      implements Set<Hash>

  A Set of Hashes that automatically adds to the Set in the contains() check. So we don't need to generate the exclude set up front. Less object churn and copying.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Set<Hash>` | `s`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ExcluderBase(Set<Hash> set)` Automatically check if peer is connected and add the Hash to the set if not.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(Hash h)`
    `boolean` | `addAll(Collection<? extends Hash> c)`
    `void` | `clear()`
    `abstract boolean` | `contains(Object o)` Automatically check if peer is allowed and add the Hash to the set if not.
    `boolean` | `containsAll(Collection<?> c)`
    `boolean` | `equals(Object o)`
    `int` | `hashCode()`
    `boolean` | `isEmpty()`
    `Iterator<Hash>` | `iterator()`
    `boolean` | `remove(Object o)`
    `boolean` | `removeAll(Collection<?> c)`
    `boolean` | `retainAll(Collection<?> c)`
    `int` | `size()`
    `Object[]` | `toArray()`
    `<Hash> Hash[]` | `toArray(Hash[] a)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Set

      `spliterator`

    - ### Methods inherited from interface java.util.Collection

      `parallelStream, removeIf, stream`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### Field Detail

    - #### s

          protected final Set<Hash> s

  - ### Constructor Detail

    - #### ExcluderBase

          protected ExcluderBase(Set<Hash> set)

      Automatically check if peer is connected and add the Hash to the set if not.
      Parameters:
        `set` - not copied, contents will be modified by all methods

  - ### Method Detail

    - #### add

          public boolean add(Hash h)

      Specified by:
        `add` in interface `Collection<Hash>`
      Specified by:
        `add` in interface `Set<Hash>`

    - #### addAll

          public boolean addAll(Collection<? extends Hash> c)

      Specified by:
        `addAll` in interface `Collection<Hash>`
      Specified by:
        `addAll` in interface `Set<Hash>`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Collection<Hash>`
      Specified by:
        `clear` in interface `Set<Hash>`

    - #### contains

          public abstract boolean contains(Object o)

      Automatically check if peer is allowed and add the Hash to the set if not.
      Specified by:
        `contains` in interface `Collection<Hash>`
      Specified by:
        `contains` in interface `Set<Hash>`
      Parameters:
        `o` - a Hash
      Returns:
        true if peer should be excluded

    - #### containsAll

          public boolean containsAll(Collection<?> c)

      Specified by:
        `containsAll` in interface `Collection<Hash>`
      Specified by:
        `containsAll` in interface `Set<Hash>`

    - #### equals

          public boolean equals(Object o)

      Specified by:
        `equals` in interface `Collection<Hash>`
      Specified by:
        `equals` in interface `Set<Hash>`
      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `Collection<Hash>`
      Specified by:
        `hashCode` in interface `Set<Hash>`
      Overrides:
        `hashCode` in class `Object`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `Collection<Hash>`
      Specified by:
        `isEmpty` in interface `Set<Hash>`

    - #### iterator

          public Iterator<Hash> iterator()

      Specified by:
        `iterator` in interface `Iterable<Hash>`
      Specified by:
        `iterator` in interface `Collection<Hash>`
      Specified by:
        `iterator` in interface `Set<Hash>`

    - #### remove

          public boolean remove(Object o)

      Specified by:
        `remove` in interface `Collection<Hash>`
      Specified by:
        `remove` in interface `Set<Hash>`

    - #### removeAll

          public boolean removeAll(Collection<?> c)

      Specified by:
        `removeAll` in interface `Collection<Hash>`
      Specified by:
        `removeAll` in interface `Set<Hash>`

    - #### retainAll

          public boolean retainAll(Collection<?> c)

      Specified by:
        `retainAll` in interface `Collection<Hash>`
      Specified by:
        `retainAll` in interface `Set<Hash>`

    - #### size

          public int size()

      Specified by:
        `size` in interface `Collection<Hash>`
      Specified by:
        `size` in interface `Set<Hash>`

    - #### toArray

          public Object[] toArray()

      Specified by:
        `toArray` in interface `Collection<Hash>`
      Specified by:
        `toArray` in interface `Set<Hash>`

    - #### toArray

          public <Hash> Hash[] toArray(Hash[] a)

      Specified by:
        `toArray` in interface `Collection<Hash>`
      Specified by:
        `toArray` in interface `Set<Hash>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`