org.apache.tinkerpop.gremlin.process.traversal.traverser.util

## Class IndexedTraverserSet<S,I>

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractSet<Traverser.Admin<S>>
    - - org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet<S>
      - - org.apache.tinkerpop.gremlin.process.traversal.traverser.util.IndexedTraverserSet<S,I>

- All Implemented Interfaces:
    Serializable, Iterable<Traverser.Admin<S>>, Collection<Traverser.Admin<S>>, Queue<Traverser.Admin<S>>, Set<Traverser.Admin<S>>
  Direct Known Subclasses:
    IndexedTraverserSet.VertexIndexedTraverserSet

      public class IndexedTraverserSet<S,I>
      extends TraverserSet<S>

  A `TraverserSet` that has an index back to the object in the `Traverser`. Using this extension of `TraverserSet` can make it easier to find traversers within the set if the internal value is known. Without the index the entire `TraverserSet` needs to be iterated to find a particular value.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `IndexedTraverserSet.VertexIndexedTraverserSet` An `IndexedTraverserSet` that indexes based on a `Vertex` traverser.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IndexedTraverserSet(Function<S,I> indexingFunction)`
    `IndexedTraverserSet(Function<S,I> indexingFunction, Traverser.Admin<S> traverser)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(Traverser.Admin<S> traverser)`
    `void` | `clear()`
    `Collection<Traverser.Admin<S>>` | `get(I k)` Gets a collection of `Traverser` objects that contain the specified value.
    `boolean` | `offer(Traverser.Admin<S> traverser)`
    `Traverser.Admin<S>` | `remove()`
    `boolean` | `remove(Object traverser)`

    - ### Methods inherited from class org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet

      `bulkSize, contains, element, get, isEmpty, iterator, peek, poll, shuffle, size, sort, spliterator, toString`

    - ### Methods inherited from class java.util.AbstractSet

      `equals, hashCode, removeAll`

    - ### Methods inherited from class java.util.AbstractCollection

      `addAll, containsAll, retainAll, toArray, toArray`

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

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

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

      `addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray`

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

      `parallelStream, removeIf, stream`

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

      `forEach`

- - ### Constructor Detail

    - #### IndexedTraverserSet

          public IndexedTraverserSet(Function<S,I> indexingFunction)

    - #### IndexedTraverserSet

          public IndexedTraverserSet(Function<S,I> indexingFunction,
                                     Traverser.Admin<S> traverser)

  - ### Method Detail

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Collection<Traverser.Admin<S>>`
      Specified by:
        `clear` in interface `Set<Traverser.Admin<S>>`
      Overrides:
        `clear` in class `TraverserSet<S>`

    - #### add

          public boolean add(Traverser.Admin<S> traverser)

      Specified by:
        `add` in interface `Collection<Traverser.Admin<S>>`
      Specified by:
        `add` in interface `Queue<Traverser.Admin<S>>`
      Specified by:
        `add` in interface `Set<Traverser.Admin<S>>`
      Overrides:
        `add` in class `TraverserSet<S>`

    - #### get

          public Collection<Traverser.Admin<S>> get(I k)

      Gets a collection of `Traverser` objects that contain the specified value.
      Parameters:
        `k` - the key produced by the indexing function
      Returns:

    - #### offer

          public boolean offer(Traverser.Admin<S> traverser)

      Specified by:
        `offer` in interface `Queue<Traverser.Admin<S>>`
      Overrides:
        `offer` in class `TraverserSet<S>`

    - #### remove

          public Traverser.Admin<S> remove()

      Specified by:
        `remove` in interface `Queue<Traverser.Admin<S>>`
      Overrides:
        `remove` in class `TraverserSet<S>`

    - #### remove

          public boolean remove(Object traverser)

      Specified by:
        `remove` in interface `Collection<Traverser.Admin<S>>`
      Specified by:
        `remove` in interface `Set<Traverser.Admin<S>>`
      Overrides:
        `remove` in class `TraverserSet<S>`

Copyright © 2013–2020 Apache Software Foundation. All rights reserved.