Package mondrian.util

Class Pair<L,​R>

    • Field Detail

      • left

        public L left
      • right

        public R right
    • Constructor Detail

      • Pair

        public Pair​(L left,
                    R right)
        Creates a pair.
        Parameters:
        left - Left value
        right - Right value
      • Pair

        public Pair​(Map.Entry<? extends L,​? extends R> entry)
        Creates a pair representing the same mapping as the specified entry.
        Parameters:
        entry - the entry to copy
    • Method Detail

      • of

        public static <L,​R> Pair<L,​R> of​(L left,
                                                     R right)
        Creates a Pair.
        Parameters:
        left - Left value
        right - Right value
        Returns:
        a new Pair
      • leftIter

        public static <L,​R> Iterable<L> leftIter​(Iterable<Pair<L,​R>> iterable)
        Returns an iterable over the left slice of an iterable.
        Type Parameters:
        L - Left type
        R - Right type
        Parameters:
        iterable - Iterable over pairs
        Returns:
        Iterable over the left elements
      • rightIter

        public static <L,​R> Iterable<R> rightIter​(Iterable<Pair<L,​R>> iterable)
        Returns an iterable over the right slice of an iterable.
        Type Parameters:
        L - right type
        R - Right type
        Parameters:
        iterable - Iterable over pairs
        Returns:
        Iterable over the right elements
      • left

        public static <L,​R> List<L> left​(List<Pair<L,​R>> list)
        Returns a list of the left elements of a list of pairs.
      • right

        public static <L,​R> List<R> right​(List<Pair<L,​R>> list)
        Returns a list of the right elements of a list of pairs.