Package com.cta4j.train.follow.model
Record Class FollowTrain
java.lang.Object
java.lang.Record
com.cta4j.train.follow.model.FollowTrain
- Record Components:
coordinates- the current coordinates of this train being followedarrivals- theListofArrivals for this train being followed
@NullMarked
public record FollowTrain(@Nullable Coordinates coordinates, List<Arrival> arrivals)
extends Record
Represents a response from the "follow" endpoint of the CTA Train Tracker API.
-
Constructor Summary
ConstructorsConstructorDescriptionFollowTrain(@Nullable Coordinates coordinates, List<Arrival> arrivals) Constructs aFollowTrain. -
Method Summary
Modifier and TypeMethodDescriptionarrivals()Returns the value of thearrivalsrecord component.@Nullable CoordinatesReturns the value of thecoordinatesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FollowTrain
Constructs aFollowTrain.- Parameters:
coordinates- the current coordinates of the train being followedarrivals- theListofArrivals for the train being followed- Throws:
NullPointerException- ifarrivalsisnull, or ifarrivalscontainsnullelements
-
-
Method Details
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
coordinates
Returns the value of thecoordinatesrecord component.- Returns:
- the value of the
coordinatesrecord component
-
arrivals
Returns the value of thearrivalsrecord component.- Returns:
- the value of the
arrivalsrecord component
-