steps, false);
}
checkSteps(steps);
- for (int i = 0; i < steps.size(); i++) {
- RebaseTodoLine step = steps.get(i);
+ for (RebaseTodoLine step : steps) {
popSteps(1);
RebaseResult result = processStep(step, true);
if (result != null) {
* @return a boolean.
*/
public boolean canAppendMatch() {
- for (int i = 0; i < heads.size(); i++) {
- if (heads.get(i) != LastHead.INSTANCE) {
+ for (Head head : heads) {
+ if (head != LastHead.INSTANCE) {
return true;
}
}
// logic linear in the size of the input rather than quadratic.
//
int cnt = 0;
- for (int i = 0; i < table.length; i++) {
- int h = table[i];
+ for (int element : table) {
+ int h = element;
if (h == 0)
continue;
protected static final String forceToRaw(String patternText) {
final byte[] b = Constants.encode(patternText);
final StringBuilder needle = new StringBuilder(b.length);
- for (int i = 0; i < b.length; i++)
- needle.append((char) (b[i] & 0xff));
+ for (byte element : b)
+ needle.append((char) (element & 0xff));
return needle.toString();
}
private static String LHEX(byte[] bin) {
StringBuilder r = new StringBuilder(bin.length * 2);
- for (int i = 0; i < bin.length; i++) {
- byte b = bin[i];
+ for (byte b : bin) {
r.append(LHEX[(b >>> 4) & 0x0f]);
r.append(LHEX[b & 0x0f]);
}
return null;
ByteArrayOutputStream os = new ByteArrayOutputStream(s.length());
byte[] bytes = s.getBytes(UTF_8);
- for (int i = 0; i < bytes.length; ++i) {
- int b = bytes[i] & 0xFF;
+ for (byte c : bytes) {
+ int b = c & 0xFF;
if (b <= 32 || (encodeNonAscii && b > 127) || b == '%'
|| (escapeReservedChars && reservedChars.get(b))) {
os.write('%');
final byte[] out = new byte[4 * in.length + 2];
int o = 0;
out[o++] = '"';
- for (int i = 0; i < in.length; i++) {
- final int c = in[i] & 0xff;
+ for (byte element : in) {
+ final int c = element & 0xff;
if (c < quote.length) {
final byte style = quote[c];
if (style == 0) {
}
while (ptr < b.length - (headerName.length + 1)) {
boolean found = true;
- for (int i = 0; i < headerName.length; i++) {
- if (headerName[i] != b[ptr++]) {
+ for (byte element : headerName) {
+ if (element != b[ptr++]) {
found = false;
break;
}