File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed
src/main/java/software/coley/lljzip/util/data Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ default MemorySegmentData copy() {
2525
2626 @ Nonnull
2727 static MemorySegmentData empty () {
28- return FullSegment . EMPTY ;
28+ return EmptySegment . INSTANCE ;
2929 }
3030
3131 @ Nonnull
@@ -85,7 +85,6 @@ public MemorySegment get() {
8585 }
8686
8787 class FullSegment implements MemorySegmentData {
88- private static final FullSegment EMPTY = new FullSegment (MemorySegmentUtil .EMPTY );
8988 private final MemorySegment segment ;
9089
9190 public FullSegment (@ Nonnull MemorySegment segment ) {
@@ -104,4 +103,16 @@ public MemorySegmentData copy() {
104103 return this ;
105104 }
106105 }
106+
107+ class EmptySegment implements MemorySegmentData {
108+ private static final EmptySegment INSTANCE = new EmptySegment ();
109+
110+ private EmptySegment () {}
111+
112+ @ Nonnull
113+ @ Override
114+ public MemorySegment get () {
115+ return MemorySegmentUtil .EMPTY ;
116+ }
117+ }
107118}
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ default StringData copy() {
2626
2727 @ Nonnull
2828 static StringData empty () {
29- return Literal . EMPTY ;
29+ return Empty . INSTANCE ;
3030 }
3131
3232 @ Nonnull
@@ -101,7 +101,6 @@ public String get() {
101101 }
102102
103103 class Literal implements StringData {
104- private static final Literal EMPTY = new Literal ("" );
105104 private final String content ;
106105
107106 public Literal (@ Nonnull String content ) {
@@ -120,4 +119,16 @@ public StringData copy() {
120119 return this ;
121120 }
122121 }
122+
123+ class Empty implements StringData {
124+ private static final Empty INSTANCE = new Empty ();
125+
126+ private Empty () {}
127+
128+ @ Nonnull
129+ @ Override
130+ public String get () {
131+ return "" ;
132+ }
133+ }
123134}
You can’t perform that action at this time.
0 commit comments