Closed earroyoron closed 4 years ago
Yes, it can. LotteryTicketRepository
is one of the driven ports. See for example the slides 10-11 on this presentation https://www.slideshare.net/fabricioepa/hexagonal-architecture-for-java-applications
public String getNumbersAsString() {
List<Integer> list = new ArrayList<>();
list.addAll(numbers);
StringBuilder builder = new StringBuilder();
for (int i = 0; i < NUM_NUMBERS; i++) {
builder.append(list.get(i));
if (i < NUM_NUMBERS - 1) {
builder.append(",");
}
}
return builder.toString();
}
Why are you instantiating a list if you could iterate over the numbers HashSet?
@andrievsky please help us improve and create a pull request
Not sure, really
can the model have dependencies of repository classes?
com.iluwatar.hexagonal.domain.LotteryService has a dependency on LotteryTicketRepository