@Test void test_books() { test_authors(); Iterable<BookWithAuthors> books = bookWithAuthorRepository.saveAll( Stream.of("ololo", "trololo") .map(title -> new BookWithAuthors(null, title)) .map(bookWithAuthors -> bookWithAuthors.addAll(authorOfBookRepository.findAll())) .collect(Collectors.toList()) ); log.info("created books: {}", books); log.info("find all: {}", bookWithAuthorRepository.findAll()); }
public BookWithAuthors addAll(Iterable<AuthorOfBook> authors) { return addAll(StreamSupport.stream(authors.spliterator(), false) .toArray(AuthorOfBook[]::new)); }
BookWithAuthors { public BookWithAuthors addAll(Iterable<AuthorOfBook> authors) { return addAll(StreamSupport.stream(authors.spliterator(), false) .toArray(AuthorOfBook[]::new)); } }
BookWithAuthors { public BookWithAuthors addAll(Iterable<AuthorOfBook> authors) { return addAll(StreamSupport.stream(authors.spliterator(), false) .toArray(AuthorOfBook[]::new)); } BookWithAuthors(Long id, String title); }
BookWithAuthors { public BookWithAuthors addAll(Iterable<AuthorOfBook> authors) { return addAll(StreamSupport.stream(authors.spliterator(), false) .toArray(AuthorOfBook[]::new)); } BookWithAuthors(Long id, String title); BookWithAuthors addAll(Iterable<AuthorOfBook> authors); BookWithAuthors addAll(AuthorOfBook... authors); }
BookWithAuthors { public BookWithAuthors addAll(Iterable<AuthorOfBook> authors) { return addAll(StreamSupport.stream(authors.spliterator(), false) .toArray(AuthorOfBook[]::new)); } BookWithAuthors(Long id, String title); BookWithAuthors addAll(Iterable<AuthorOfBook> authors); BookWithAuthors addAll(AuthorOfBook... authors);  }