@@ -30,7 +30,7 @@ public GlyphLine(List<Glyph> glyphs, int start, int end) {
30
30
this .end = end ;
31
31
}
32
32
33
- public GlyphLine (List <Glyph > glyphs , List <ActualText > actualText , int start , int end ) {
33
+ protected GlyphLine (List <Glyph > glyphs , List <ActualText > actualText , int start , int end ) {
34
34
this (glyphs , start , end );
35
35
this .actualText = actualText ;
36
36
}
@@ -217,8 +217,8 @@ public GlyphLine filter(GlyphLineFilter filter) {
217
217
public void setActualText (int left , int right , String text ) {
218
218
if (this .actualText == null ) {
219
219
this .actualText = new ArrayList <>(glyphs .size ());
220
- List < ActualText > actualText = Collections . nCopies ( glyphs .size (), null );
221
- this .actualText .addAll ( actualText );
220
+ for ( int i = 0 ; i < glyphs .size (); i ++)
221
+ this .actualText .add ( null );
222
222
}
223
223
ActualText actualText = new ActualText (text );
224
224
for (int i = left ; i < right ; i ++) {
@@ -241,8 +241,9 @@ private void removeGlyph(int index) {
241
241
private void addAllGlyphs (int index , List <Glyph > additionalGlyphs ) {
242
242
glyphs .addAll (index , additionalGlyphs );
243
243
if (actualText != null ) {
244
- List <ActualText > actualTexts = Collections .nCopies (additionalGlyphs .size (), null );
245
- actualText .addAll (index , actualTexts );
244
+ for (int i = 0 ; i < additionalGlyphs .size (); i ++) {
245
+ this .actualText .add (index , null );
246
+ }
246
247
}
247
248
}
248
249
0 commit comments