Package org.plumelib.util
Record Class CollectionsP.Replacement<T>
java.lang.Object
java.lang.Record
org.plumelib.util.CollectionsP.Replacement<T>
- Type Parameters:
T- the type of collection elements- Record Components:
start- the first index to replace, inclusive; must be non-negativeend- the last index to replace, inclusive; may bestart-1 to indicate an empty range (an insertion)elements- the new (replacement) elements
- Enclosing class:
CollectionsP
public static record CollectionsP.Replacement<T>(int start, int end, Collection<T> elements)
extends Record
Represents a replacement of one range of a collection by another collection.
-
Constructor Summary
ConstructorsConstructorDescriptionReplacement(int start, int end, Collection<T> elements) Creates a new Replacement. -
Method Summary
Modifier and TypeMethodDescriptionelements()Returns the value of theelementsrecord component.intend()Returns the value of theendrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static <T> CollectionsP.Replacement<T> of(int start, int end, Collection<T> elements) Creates a new Replacement.intstart()Returns the value of thestartrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
Replacement
Creates a new Replacement.- Parameters:
start- the first index to replace, inclusive; must be non-negativeend- the last index to replace, inclusive; may bestart-1 to indicate an empty range (an insertion)elements- the new (replacement) elements
-
-
Method Details
-
of
Creates a new Replacement.- Type Parameters:
T- the type of elements of the list- Parameters:
start- the first index to replace, inclusive; must be non-negativeend- the last index to replace, inclusive; may bestart-1 to indicate an empty range (an insertion)elements- the new (replacement) elements- Returns:
- a new Replacement
-
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
public final int 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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
start
public int start()Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
end
public int end()Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-
elements
Returns the value of theelementsrecord component.- Returns:
- the value of the
elementsrecord component
-