Last active
March 25, 2025 18:40
-
-
Save sandokandias/73aad58498540cf6a6a5c5ebe498593a to your computer and use it in GitHub Desktop.
Java class that represents a Order with immutable properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Order { | |
public final UUID id; | |
public final ZonedDateTime createdAt; | |
public final String customerName; | |
public final List<String> items; | |
public final Integer totalAmount; | |
public Order(UUID id, ZonedDateTime createdAt, String customerName, List<String> items, Integer totalAmount) { | |
this.id = id; | |
this.createdAt = createdAt; | |
this.customerName = customerName; | |
this.items = List.copyOf(items); | |
this.totalAmount = totalAmount; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment