class InMemoryTicketRepository implements LotteryTicketRepository {

  private static final Map<LotteryTicketId, LotteryTicket> tickets = new HashMap<>();

  @Override
  public Optional<LotteryTicket> findById(LotteryTicketId id) {
    return Optional.ofNullable(tickets.get(id));
  }

  @Override
  public Optional<LotteryTicketId> save(LotteryTicket ticket) {<FILL_FUNCTION_BODY>}

  @Override
  public Map<LotteryTicketId, LotteryTicket> findAll() {
    return tickets;
  }

  @Override
  public void deleteAll() {
    tickets.clear();
  }
}

    var id = new LotteryTicketId();
    tickets.put(id, ticket);
    return Optional.of(id);
  
<no_super_class>