private Long findFirstFlashCardId() { List<Tag> tags = tagRepository.findAll(); Optional<Tag> firstTag = tags.stream().filter(tag -> tag.getFlashCards().size() > 0).findFirst(); return firstTag.isPresent() ? firstTag.get().getFlashCards().iterator().next().getId() : null; }
private Long findFirstTagId() { return tagRepository.findAll(new PageRequest(0, 1)).iterator().next().getId(); }