From 37434ba0cba68ea232efea0824d3f71e5e287dc2 Mon Sep 17 00:00:00 2001
From: Reinier Zwitserloot ArrayList
is used to store added elements as call methods of a @Singular
marked field, if the target collection is from the java.util
package, even if the collection is a set or map. Because lombok ensures that generated collections are compacted, a new backing instance of a set or map must be constructed anyway, and storing the data as an ArrayList
during the build process is more efficient that storing it as a map or set. This behaviour is not externally visible, an implementation detail of the current implementation of the java.util
recipes for @Singular @Builder
.
With toBuilder = true
applied to methods, any type parameter of the annotated method itself must also show up in the return type.
+
+ The initializer on a @Builder.Default
field is removed and stored in a static method, in order to guarantee that this initializer won't be executed at all if a value is specified in the build. This does mean the initializer cannot refer to this
, super
or any non-static member. If lombok generates a constructor for you, it'll also initialize this field with the initializer.