net.alantea.swing.keyvalue.KeyValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swingplus Show documentation
Show all versions of swingplus Show documentation
Addons over swing package.
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