Character class with name, gender, and inventory list
This is a very straightforward implementation. Not much to improve.

Especially copying the list passed in from the caller is a good safety measure, as it makes sure that, if the caller later modifies his list, this doesn't affect the Character's inventory. It's always a good idea that changing an instance's state is done by using its methods (so it can adjust itself appropriately, e.g. drop some items if the inventory becomes too heavy).

A few ideas to think about:

Similarly to the constructor, you can make the getInventory() method safe against a caller's attempts to modify the list, by encapsulating it in a read-only wrapper:

return Collections.unmodifiableList(inventory);


Then the caller can read the list, but not change it.

You might want to implement some more inventory methods to add, remove or find inventory items.

There also is a programming style where you wouldn't implement add, remove or find methods for the inventory, and have the getInventory() method return the internal list, allowing the caller to directly modify that list. But that breaks encapsulation and generally leads to quality problems, so don't do it that way.

Probably, the ordering of items in the inventory doesn't matter, so you could use a Set instead of a List (but then you can't have multiple instances of the same item).

And you could change the constructor parameter inventory from List to Collection, allowing the caller to pass the items as List or Set, whatever suits him better.

Maybe, when your project evolves, you'll find that inventory items could have their own properties and behaviour, so you might want to change from List&lt;String&gt; to List&lt;InventoryItem&gt; early.