Skip to content

Blog

Building collections in a loop, with builders

Zazr's collections never change. That is what makes them safe to share, but it raises a question the first time you fill one in a loop: if adding an element gives a new collection, what does the loop cost?

This post shows the answer, a builder: what it is, how to use one, what it doesn't let you do, and which builder goes with which collection.

Zazr types in JSON, with Jackson and avaje-jsonb

Zazr 0.3.0 comes with two new modules: zazr-jackson for Jackson 3, and zazr-avaje-jsonb for avaje-jsonb. With either of them, a record that holds Zazr collections, Option or tuples becomes JSON and comes back, without any code of your own.

This post shows why a module is needed, how to add each one, the JSON they write, and what they check when they read.

Property-based testing with zazr-test

Zazr comes with a second artifact, zazr-test, for property-based testing. You state a rule that must hold for every input, and it tries the rule on hundreds of generated inputs. It runs inside the tests you already have, JUnit or any other framework.

This post shows what property-based testing is, how to write a check and read its failure, how to generate values and explain failures, how to replay a failure, and how to check the rules of your own types.

Meet Zazr: a Vavr fork bringing modern functional programming to Java

Zazr is a library of immutable collections and functional types for Java 25 and later. It is built on what the language now offers: records, sealed interfaces and pattern matching. Its tagline says where the ideas come from: inspired by Scala 2.13+, ZIO, and zio-prelude.

This post says what Zazr is, why we built it, what it borrows and why, and where it stands today.