Module org.tquadrat.foundation.base
Package org.tquadrat.foundation.lang
Record Class NameValuePair<V>
java.lang.Object
java.lang.Record
org.tquadrat.foundation.lang.NameValuePair<V>
- Type Parameters:
V
- The type of the value.- Record Components:
name
- The name; may not benull
, and it may not be empty.value
- The value; can benull
.
@ClassVersion(sourceVersion="$Id: NameValuePair.java 1119 2024-03-16 09:03:57Z tquadrat $")
@API(status=STABLE,
since="0.1.0")
public record NameValuePair<V>(String name, V value)
extends Record
An implementation of a name-value-pair.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: NameValuePair.java 1119 2024-03-16 09:03:57Z tquadrat $
- Since:
- 0.1.0
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.lang.NameValuePair"
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNameValuePair
(String name, V value) Creates a new instance ofNameValuePair
.NameValuePair
(Map.Entry<String, ? extends V> entry) Creates a new instance ofNameValuePair
from the givenMap.Entry
instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.name()
Returns the value of thename
record component.final NameValuePair
<V> Creates a new instance ofNameValuePair
that takes the name from this instance and assigns the given new value.final String
toString()
Returns a string representation of this record class.value()
Returns the value of thevalue
record component.
-
Field Details
-
Constructor Details
-
NameValuePair
Creates a new instance ofNameValuePair
.- Parameters:
name
- The name; may not benull
, and it may not be empty.value
- The value; can benull
.
-
NameValuePair
Creates a new instance ofNameValuePair
from the givenMap.Entry
instance.- Parameters:
entry
- The entry.
-
-
Method Details
-
newValue
Creates a new instance ofNameValuePair
that takes the name from this instance and assigns the given new value.- Parameters:
newValue
- The new value; may benull
.- Returns:
- The new instance.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
value
Returns the value of thevalue
record component.- Returns:
- the value of the
value
record component
-