feature: add Unknown type

This commit is contained in:
Kadir Sirimsi 2025-02-10 16:14:07 +01:00
parent 981180fdb0
commit 8879189e92
No known key found for this signature in database
GPG Key ID: A21C0144C2D2A134

View File

@ -5,7 +5,8 @@ import java.util.Arrays;
public enum ItemType {
AgedBrie("Aged Brie"),
BackstagePass("Backstage passes to a TAFKAL80ETC concert"),
Sulfuras("Sulfuras, Hand of Ragnaros");
Sulfuras("Sulfuras, Hand of Ragnaros"),
Unknown("Unknown");
private final String name;
@ -21,6 +22,6 @@ public enum ItemType {
return Arrays.stream(ItemType.values())
.filter(itemType -> itemType.getName().equals(name))
.findFirst()
.orElseThrow( () -> new IllegalArgumentException(name));
.orElse(Unknown);
}
}