Class Pair<E1,​E2>

  • Type Parameters:
    E1 - Type of the first element.
    E2 - Type of the second element.
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.Object>, java.util.Collection<java.lang.Object>, java.util.Deque<java.lang.Object>, java.util.List<java.lang.Object>, java.util.Queue<java.lang.Object>
    Direct Known Subclasses:
    GraphAnalyzer.IndexedList

    public class Pair<E1,​E2>
    extends Tuple<java.lang.Object>
    Generic pair data structure.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Thomas Huining Feng
    See Also:
    Serialized Form
    Pt.AcceptedRating:
    Red (tfeng)
    Pt.ProposedRating:
    Yellow (tfeng)
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair​(E1 first, E2 second)
      Construct a pair with two elements.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      E1 getFirst()
      Get the first element.
      E2 getSecond()
      Get the second element.
      void set​(E1 first, E2 second)
      Set the two elements in this pair.
      void setFirst​(E1 first)
      Set the first element in this pair.
      void setSecond​(E2 second)
      Set the second element in this pair.
      • Methods inherited from class java.util.LinkedList

        add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArray
      • Methods inherited from class java.util.AbstractSequentialList

        iterator
      • Methods inherited from class java.util.AbstractList

        equals, hashCode, listIterator, removeRange, subList
      • Methods inherited from class java.util.AbstractCollection

        containsAll, isEmpty, removeAll, retainAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.util.Deque

        iterator
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
    • Constructor Detail

      • Pair

        public Pair​(E1 first,
                    E2 second)
        Construct a pair with two elements.
        Parameters:
        first - The first element.
        second - The second element.
    • Method Detail

      • getFirst

        public E1 getFirst()
        Get the first element.
        Specified by:
        getFirst in interface java.util.Deque<E1>
        Overrides:
        getFirst in class java.util.LinkedList<java.lang.Object>
        Returns:
        The first element.
        See Also:
        setFirst(Object)
      • getSecond

        public E2 getSecond()
        Get the second element.
        Returns:
        The second element.
        See Also:
        setSecond(Object)
      • set

        public void set​(E1 first,
                        E2 second)
        Set the two elements in this pair.
        Parameters:
        first - The first element.
        second - The second element.
      • setFirst

        public void setFirst​(E1 first)
        Set the first element in this pair.
        Parameters:
        first - The first element.
        See Also:
        getFirst()
      • setSecond

        public void setSecond​(E2 second)
        Set the second element in this pair.
        Parameters:
        second - The first element.
        See Also:
        getSecond()