Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public Optional<FoodOverrideData> from(DataContainer container) {
Optional<Integer> hunger = container.getInt(QHUNGER);
Optional<Double> saturation = container.getDouble(QSATURATION);
//Not sure this is right... if the query fails, should it return Optional.absent?
return Optional.of(new FoodOverrideData(hunger, saturation)); //Constructor constructs the default values for missing values
* if(hunger.isPresent() && saturation.isPresent()) return Optional.of(new FoodOverrideData(hunger, saturation);
* else return Optional.absent();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment