All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.alantea.swing.keyvalue.KeyValue Maven / Gradle / Ivy

The newest version!
package net.alantea.swing.keyvalue;

public class KeyValue implements Comparable>
{
   private K key;
   private V value;
   
   public KeyValue(K key, V value)
   {
      super();
      this.key = key;
      this.value = value;
   }

   public K getKey()
   {
      return key;
   }

   public void setKey(K key)
   {
      this.key = key;
   }

   public V getValue()
   {
      return value;
   }

   public void setValue(V value)
   {
      this.value = value;
   };
   
   @SuppressWarnings("unchecked")
   @Override
   public int compareTo(KeyValue o)
   {
      if (key instanceof Comparable)
      {
         return ((Comparable) key).compareTo(o.getKey());
      }
      else
      {
         return key.toString().compareTo(o.getKey().toString());
      }
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy