new BidiRun[0] happens too often. Introduce EMPTY_ARRAY

This commit is contained in:
Konstantin Bulenkov
2016-07-08 01:43:50 +02:00
parent f98bd7cc8a
commit f97bd765ee
@@ -266,7 +266,7 @@ abstract class LineLayout {
assert startOffset <= endOffset;
final BidiRun[] runs;
if (startOffset == endOffset) {
runs = new BidiRun[0];
runs = BidiRun.EMPTY_ARRAY;
}
else {
List<BidiRun> runList = new ArrayList<BidiRun>();
@@ -338,7 +338,7 @@ abstract class LineLayout {
}
private BidiRun[] createRuns() {
if (myChunk == null) return new BidiRun[0];
if (myChunk == null) return BidiRun.EMPTY_ARRAY;
BidiRun run = new BidiRun(myChunk.endOffset);
run.chunks = new Chunk[] {myChunk};
return new BidiRun[] {run};
@@ -474,6 +474,7 @@ abstract class LineLayout {
}
private static class BidiRun {
public static final BidiRun[] EMPTY_ARRAY = new BidiRun[0];
private static final int CHUNK_CHARACTERS = 1024;
private final byte level;