Joink is a library for joining together collections of Java 8 objects in memory.
Here’s what that looks like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
@Test public void joins_one_to_many() { List<Tuple2<Author, Set<Book>>> joined = Joins.join(Arrays.stream(authors)) .on(Author::getId) .to(Book::getAuthorId) .oneToMany(Arrays.stream(books)) .collect(Collectors.toList()); assertThat(joined, hasItems( Tuple2.of(badiou, books(beingAndEvent, logicsOfWorlds, theoryOfTheSubject)), Tuple2.of(derrida, books(ofGrammatology, spectresOfMarx)), Tuple2.of(deleuzeAndGuattari, books(antiOedipus, aThousandPlateaus)), Tuple2.of(levinas, books(totalityAndInfinity)), Tuple2.of(kolozova, books(cutOfTheReal)), Tuple2.of(notAppearing, books()) )); } |
Currently supported: inner, outer, left-outer and right-outer joins, as well as many-to-one, one-to-many and one-to-one joins (“strict”, which enforces uniqueness, and non-strict which doesn’t).
Soon to come: Octarine integration.