Class Pair<K,​V>


  • public class Pair<K,​V>
    extends java.lang.Object
    This class can be used to return a combination of generic types.
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair()  
      Pair​(K key, V value)
      Instantiates a new Pair.
    • Constructor Detail

      • Pair

        public Pair()
      • Pair

        public Pair​(K key,
                    V value)
        Instantiates a new Pair.
        Parameters:
        key - a generic type to be used as key
        value - a generic type to be used as value
    • Method Detail

      • getKey

        public K getKey()
      • setKey

        public void setKey​(K key)
      • getValue

        public V getValue()
      • setValue

        public void setValue​(V value)
      • newInstance

        public static <K,​V> Pair<K,​V> newInstance​(K key,
                                                              V value)
        Returns a new pair of the given generic type combination.
        Parameters:
        key - the key generic object
        value - the value generic object
        Returns:
        a new pair of key and value