Package se.datadosen.util
Class NameValue<T>
java.lang.Object
se.datadosen.util.NameValue<T>
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable
public class NameValue<T>
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable
Class that allows an arbitrary value to be tagged along a visible string
Enables for instance JComboBoxes to display strings but also supply an arbitrary value with each item
Similar to Item, but with the visible name being in focus
(i.e. equals(), hashCode() and compareTo() considers the visible name and not the value)
- Since:
- v11
- See Also:
- Serialized Form
-
Field Details
-
Constructor Details
-
Method Details
-
equals
public boolean equals(java.lang.Object obj)Compares to other NameValues (considering name only) or to other Strings- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object o)- Specified by:
compareTo
in interfacejava.lang.Comparable<T>
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-