Sample
int-f5cedf13269c-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.533 | 0–1; higher is more readable |
| Dorn | 0.788 | 0–1; higher is more readable |
| Mi | 0.282 | 0–1; higher is more readable |
| LLOC | 54 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.365 | 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. | 5160.734 | −170.304 |
| Source linesThe number of non-empty source lines. | 137 | +54.8 |
| 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.978 | −7.467 |
Intercept 8.87 + feature contributions = -114.101 (log-odds).
Score = sigmoid(-114.101) = 0.
| Score | 0.533 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 138 | −3.85 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 124 | +3.552 |
| 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. | 123.978 | −1.586 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 136.84 | +1.503 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 123.993 | +1.196 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.094 | +0.027 |
Intercept 0.07 + feature contributions = 1.31 (log-odds).
Score = sigmoid(1.31) = 0.788.
| Score | 0.282 |
|---|
| Score | 54 |
|---|
Run 1
The code is generally clear, with good class structure and meaningful method names. However, the 'convert' method has some readability issues: the iteration blocks use awkward 'loopIterator' variables and explicit Iterator syntax instead of for-each loops, making the code feel more verbose and less natural to read. The nested braces around the while loops add visual noise without clear purpose. The logic for detecting whether copying is required is spread across the loop, which slightly obscures intent. The helper methods are well-separated and concise, but the overall flow in 'convert' could be simplified. The use of blocks to isolate loops is unconventional and disrupts reading flow. While the code is not deeply nested or ambiguous overall, the iteration style and block usage reduce its clarity compared to idiomatic Java.
Run 2
The code has clear structure with separated methods and a helper class, but suffers from several readability issues. The convert method contains unnatural iteration using raw iterator variables with extra braces, which interrupts the established concise style and creates unnecessary boilerplate. The action granularity in these loops is awkward — multiple operations per line with explicit type casts. Reading flow is disrupted by the non-idiomatic loops that could use enhanced for-each. Nesting is mostly flat, which is good. The intent of the converter is clear from the Javadoc and method names, though the two-phase build approach (accumulate entries, then populate map) adds cognitive overhead. Code length is reasonable overall but the loop constructs make it unnecessarily long. The @SuppressWarnings and explicit casts further reduce clarity. Overall, solid conceptual organization with inconsistent implementation style.
Run 3
The code is logically structured with clear responsibilities and helpful comments, but readability suffers from inconsistent and awkward iteration blocks that interrupt the natural flow. The use of raw Map.Entry casts and manual iterator loops in separate scoped blocks adds unnecessary noise compared to standard for-each syntax. Nesting is generally shallow, and methods are concise with single-purpose actions. However, the 'copyRequired' logic is slightly scattered across the main method, and the second iteration block repeats the same awkward pattern. Overall, the code is maintainable but could be significantly improved by replacing the iterator blocks with direct for-each loops and consolidating related logic.
Run 1
Code Structure: Well organized into interface methods, conversion helpers, and a small entry class. Nesting: Mostly shallow, with early returns, though redundant blocks around iterator loops add unnecessary nesting. Clarity of intent: Documentation, descriptive names, and explicit key/value conversion make the purpose clear; the deferred-copy strategy requires some attention. Code length: Reasonable overall, but manual iterators, casts, and temporary entry storage introduce verbosity; enhanced for-loops would simplify traversal. Action granularity: Statements generally perform one action per line, making operations easy to follow. Reading flow: Conversion proceeds logically from validation through entry conversion to target-map creation, but inconsistent indentation, fully qualified iterator types, unnecessary parentheses, and mechanical iterator names interrupt otherwise natural flow.
Run 2
Code Structure: Well organized into conversion logic, focused helpers, and a small entry class. Nesting: Mostly shallow, with early returns reducing complexity; unnecessary blocks around iterator loops add nesting. Clarity of intent: Descriptive names, documentation, and explicit key/value conversion make the purpose clear, although copyRequired and the two-stage collection process require some attention. Code length: Reasonably concise overall, but manual iterator loops, casts, and extra blocks are more verbose than enhanced for-loops. Action granularity: Statements generally perform one action per line, making operations easy to follow. Reading flow: The progression from validation through conversion to map creation is logical, but inconsistent loop indentation, fully qualified iterator declarations, redundant parentheses, and generic iterator names disrupt readability.
Run 3
Code Structure: Well organized into conversion methods, focused helpers, and a small entry class. Nesting: Early returns keep nesting moderate, although redundant blocks around iterator loops add visual depth. Clarity of intent: Descriptive names and documentation explain map conversion and copy avoidance; reference-identity checks require some thought. Code length: Mostly justified, but explicit iterators, casts, and extra blocks are more verbose than enhanced for-loops. Action granularity: Statements generally perform one action per line, making operations easy to follow. Reading flow: The progression from validation to entry conversion, copy detection, and target creation is logical. Inconsistent loop indentation, fully qualified iterator types, and awkward names such as loopIteratorA interrupt otherwise readable formatting.