Class Ord<E>

java.lang.Object
org.apache.calcite.linq4j.Ord<E>
Type Parameters:
E - Element type
All Implemented Interfaces:
Map.Entry<Integer,E>

public class Ord<E> extends Object implements Map.Entry<Integer,E>
Pair of an element and an ordinal.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final E
     
    final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ord(int i, E e)
    Creates an Ord.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> void
    forEach(Iterable<T> iterable, ObjIntConsumer<? super T> action)
    Applies an action to every element of an iterable, passing the zero-based ordinal of the element to the action.
    static <T> void
    forEach(T[] ts, ObjIntConsumer<? super T> action)
    Applies an action to every element of an array, passing the zero-based ordinal of the element to the action.
     
     
    static <E> Ord<E>
    of(int n, E e)
    Creates an Ord.
    static <E> Iterable<Ord<E>>
    reverse(E... elements)
    Iterates over an array in reverse order.
    static <E> Iterable<Ord<E>>
    reverse(Iterable<? extends E> elements)
    Iterates over a list in reverse order.
    setValue(E value)
     
    static <E> List<Ord<E>>
    zip(E[] elements)
    Returns a numbered list based on an array.
    static <E> Iterable<Ord<E>>
    zip(Iterable<? extends E> iterable)
    Creates an iterable of Ords over an iterable.
    static <E> Iterator<Ord<E>>
    zip(Iterator<? extends E> iterator)
    Creates an iterator of Ords over an iterator.
    static <E> List<Ord<E>>
    zip(List<? extends E> elements)
    Returns a numbered list.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.Map.Entry

    equals, hashCode
  • Field Details

    • i

      public final int i
    • e

      public final E e
  • Constructor Details

    • Ord

      public Ord(int i, E e)
      Creates an Ord.
  • Method Details

    • of

      public static <E> Ord<E> of(int n, E e)
      Creates an Ord.
    • zip

      public static <E> Iterable<Ord<E>> zip(Iterable<? extends E> iterable)
      Creates an iterable of Ords over an iterable.
    • zip

      public static <E> Iterator<Ord<E>> zip(Iterator<? extends E> iterator)
      Creates an iterator of Ords over an iterator.
    • zip

      public static <E> List<Ord<E>> zip(E[] elements)
      Returns a numbered list based on an array.
    • zip

      public static <E> List<Ord<E>> zip(List<? extends E> elements)
      Returns a numbered list.
    • reverse

      public static <E> Iterable<Ord<E>> reverse(E... elements)
      Iterates over an array in reverse order.

      Given the array ["a", "b", "c"], returns (2, "c") then (1, "b") then (0, "a").

    • reverse

      public static <E> Iterable<Ord<E>> reverse(Iterable<? extends E> elements)
      Iterates over a list in reverse order.

      Given the list ["a", "b", "c"], returns (2, "c") then (1, "b") then (0, "a").

    • getKey

      public Integer getKey()
      Specified by:
      getKey in interface Map.Entry<Integer,E>
    • getValue

      public E getValue()
      Specified by:
      getValue in interface Map.Entry<Integer,E>
    • setValue

      public E setValue(E value)
      Specified by:
      setValue in interface Map.Entry<Integer,E>
    • forEach

      public static <T> void forEach(Iterable<T> iterable, ObjIntConsumer<? super T> action)
      Applies an action to every element of an iterable, passing the zero-based ordinal of the element to the action.
      Type Parameters:
      T - Element type
      Parameters:
      iterable - Iterable
      action - The action to be performed for each element
      See Also:
    • forEach

      public static <T> void forEach(T[] ts, ObjIntConsumer<? super T> action)
      Applies an action to every element of an array, passing the zero-based ordinal of the element to the action.
      Type Parameters:
      T - Element type
      Parameters:
      ts - Array
      action - The action to be performed for each element
      See Also: