protected final IntList lines;
/** Hash code for each line, for fast equality elimination. */
- protected final IntList hashes;
+ protected final int[] hashes;
/**
* Create a new sequence from an existing content byte array.
private static boolean equals(final RawText a, final int ai,
final RawText b, final int bi) {
- if (a.hashes.get(ai) != b.hashes.get(bi))
+ if (a.hashes[ai] != b.hashes[bi])
return false;
int as = a.lines.get(ai);
return content[end - 1] != '\n';
}
- private IntList computeHashes() {
- final IntList r = new IntList(lines.size());
- r.add(0);
+ private int[] computeHashes() {
+ final int[] r = new int[lines.size()];
for (int lno = 1; lno < lines.size() - 1; lno++) {
final int ptr = lines.get(lno);
final int end = lines.get(lno + 1);
- r.add(hashLine(content, ptr, end));
+ r[lno] = hashLine(content, ptr, end);
}
- r.add(0);
return r;
}
private static boolean equals(final RawText a, final int ai,
final RawText b, final int bi) {
- if (a.hashes.get(ai) != b.hashes.get(bi))
+ if (a.hashes[ai] != b.hashes[bi])
return false;
int as = a.lines.get(ai);
private static boolean equals(final RawText a, final int ai,
final RawText b, final int bi) {
- if (a.hashes.get(ai) != b.hashes.get(bi))
+ if (a.hashes[ai] != b.hashes[bi])
return false;
int as = a.lines.get(ai);
private static boolean equals(final RawText a, final int ai,
final RawText b, final int bi) {
- if (a.hashes.get(ai) != b.hashes.get(bi))
+ if (a.hashes[ai] != b.hashes[bi])
return false;
int as = a.lines.get(ai);
private static boolean equals(final RawText a, final int ai,
final RawText b, final int bi) {
- if (a.hashes.get(ai) != b.hashes.get(bi))
+ if (a.hashes[ai] != b.hashes[bi])
return false;
int as = a.lines.get(ai);