Add Page constructor for empty blocks case
Avoids varargs empty array creation per call for these usage sites
@@ -33,6 +33,7 @@ import static java.util.Objects.requireNonNull;
public final class Page
{
public static final int INSTANCE_SIZE = ClassLayout.parseClass(Page.class).instanceSize();
+ private static final Block[] EMPTY_BLOCKS = new Block[0];
/**
* Visible to give trusted classes like {@link PageBuilder} access to a constructor that doesn't
@@ -54,6 +55,11 @@ public final class Page
this(true, determinePositionCount(blocks), blocks);
}
+ public Page(int positionCount)
+ {
+ this(false, positionCount, EMPTY_BLOCKS);
+ }
+
public Page(int positionCount, Block... blocks)
{
this(true, positionCount, blocks);
