Sample
int-49110c400382-I13
Lower every eligible classic and enhanced for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.61 | 0–1; higher is more readable |
| Dorn | 0.729 | 0–1; higher is more readable |
| Mi | 0.549 | 0–1; higher is more readable |
| LLOC | 14 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 19 | 0–20; mean of three runs |
| BTTF | 0.613 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 1421.457 | −46.908 |
| Source linesThe number of non-empty source lines. | 49 | +19.6 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 4.754 | −7.131 |
Intercept 8.87 + feature contributions = -25.57 (log-odds).
Score = sigmoid(-25.57) = 0.
| Score | 0.61 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 99.92 | +0.808 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 50 | −0.734 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 39 | +0.612 |
| Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names. | 99.9 | −0.566 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 48.822 | +0.273 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.083 | +0.131 |
Intercept 0.07 + feature contributions = 0.991 (log-odds).
Score = sigmoid(0.991) = 0.729.
| Score | 0.549 |
|---|
| Score | 14 |
|---|
Run 1
The code is highly readable with clear structure and intent. The class serves a single purpose as a backward-compatibility adapter, and the Javadoc explains its role well. Nesting is minimal, code length is appropriate, and each method performs one action. The only minor issue is the null check in next(), which could be considered a slight defensive redundancy depending on the iterator contract, but it doesn't significantly impact readability.
Run 2
The code is well-structured and highly readable. It clearly implements the KeyValueIterator interface with a clean adapter pattern. The class has a focused responsibility (adding header format during iteration), which is evident from the concise Javadoc. Methods are flat and each performs a single, clearly defined action, maintaining excellent action granularity. The reading flow is natural — methods are logically ordered and straightforward. Nesting is minimal, limited to a single null check. The one-line null check within next() slightly impacts code length but is acceptable given its simplicity. Naming conventions are strong, with clear parameter names like innerIterator. Imports are properly organized. Overall, the code balances conciseness with clarity, uses appropriate delegation, and maintains a clean structure with no unnecessary complexity.
Run 3
The code demonstrates excellent readability through clear structure and intent. It follows a simple adapter pattern with a single responsibility, delegating to an inner iterator and transforming values. Nesting is minimal with only one conditional check. Each method performs a single action, and the class has appropriate documentation explaining its purpose. The code is concise without being cryptic, and the reading flow is natural - constructor, then simple delegating methods, then the transformation method. Variable and method names are self-explanatory. The only minor deductions are for the null check in next() which could be slightly more explicit, and the lack of @Override annotations on some methods that implement interface methods (though this is a minor style concern).
Run 1
Code Structure: A focused adapter class cleanly separates construction, iterator delegation, and value conversion. Nesting: Methods are flat, with only a simple null guard in next(). Clarity of intent: Descriptive class and method names, a clear Javadoc explanation, and convertToHeaderFormat make the compatibility purpose explicit. Code length: Concise, with minimal delegation boilerplate and no unnecessary logic. Action granularity: Each statement performs a distinct action; the final return combines conversion and pair creation without becoming difficult to follow. Reading flow: The code progresses naturally from initialization through iterator operations to the adapted next() behavior. Minor formatting improvements, such as separating the package declaration and import groups with blank lines, would improve scanability.
Run 2
Code Structure: A well-organized iterator adapter cleanly separates delegation from value conversion. Nesting: Minimal nesting, with a single guard clause in next(). Clarity of intent: Descriptive names and class documentation clearly explain the compatibility purpose and headers conversion. Code length: Concise; delegation methods are necessary rather than redundant clutter. Action granularity: Each statement performs one clear action, with the final return naturally combining conversion and pair construction. Reading flow: Constructor, delegation methods, and conversion logic follow a straightforward progression. Minor formatting improvements, such as blank lines between the package declaration and import groups, would improve visual separation.
Run 3
Code Structure: A well-organized iterator adapter separates delegation from value conversion into small methods. Nesting: Nearly flat, with only a simple null-check guard in next(). Clarity of intent: Descriptive class and variable names, explicit interface implementation, and useful documentation clearly explain the compatibility purpose. Code length: Concise, with minimal boilerplate required by the iterator interface. Action granularity: Each statement performs one clear action; the final return naturally combines conversion with result construction. Reading flow: Documentation, field, constructor, and iterator methods follow a natural progression. Minor readability improvements would include blank lines separating the package declaration, regular imports, and static import.