Record Class Cart.CartSize
java.lang.Object
java.lang.Record
edu.uw.tcss.model.Cart.CartSize
- Record Components:
itemOrderCount- the number of unique ItemOrder objects in the cartitemCount- the total quantity of all items in the cart
- Enclosing interface:
Cart
A record representing the size of a shopping cart.
- Version:
- Winter 2026
- Author:
- Charles Bryan
-
Constructor Summary
ConstructorsConstructorDescriptionCartSize(int itemOrderCount, int itemCount) Creates an instance of aCartSizerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of theitemCountrecord component.intReturns the value of theitemOrderCountrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CartSize
public CartSize(int itemOrderCount, int itemCount) Creates an instance of aCartSizerecord class.- Parameters:
itemOrderCount- the value for theitemOrderCountrecord componentitemCount- the value for theitemCountrecord component
-
-
Method Details
-
toString
-
hashCode
-
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 with thecomparemethod from their corresponding wrapper classes. -
itemOrderCount
public int itemOrderCount()Returns the value of theitemOrderCountrecord component.- Returns:
- the value of the
itemOrderCountrecord component
-
itemCount
-