Class IndexedByShardIdFromSingleton<T>

java.lang.Object
org.elasticsearch.compute.lucene.IndexedByShardIdFromSingleton<T>
All Implemented Interfaces:
IndexedByShardId<T>

public class IndexedByShardIdFromSingleton<T> extends Object implements IndexedByShardId<T>
A simple implementation when there's only a single value being used.
  • Constructor Details

    • IndexedByShardIdFromSingleton

      public IndexedByShardIdFromSingleton(T value)
    • IndexedByShardIdFromSingleton

      public IndexedByShardIdFromSingleton(T value, int shardId)
  • Method Details

    • get

      public T get(int shardId)
      Specified by:
      get in interface IndexedByShardId<T>
    • iterable

      public Iterable<? extends T> iterable()
      Description copied from interface: IndexedByShardId
      This is not necessarily an iterable of all values visible via get(int), but rather, an iterable of the relevant values. This is useful when you need to perform an operation over all relevant values, e.g., closing them.
      Specified by:
      iterable in interface IndexedByShardId<T>
    • size

      public int size()
      Description copied from interface: IndexedByShardId
      The number of elements returned by IndexedByShardId.iterable().
      Specified by:
      size in interface IndexedByShardId<T>
    • map

      public <S> IndexedByShardId<S> map(Function<T,S> mapper)
      Description copied from interface: IndexedByShardId
      The elements are mapped lazily, i.e., the function would also apply to future elements (as opposed to collection().stream().map, which only maps the current elements).
      Specified by:
      map in interface IndexedByShardId<T>