Sample

int-a592b3c61958-I12

Inline all eligible single-use intermediate local variables

Matched original source

Lines53

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.7950–1; higher is more readable
Dorn0.4740–1; higher is more readable
Mi0.7160–1; higher is more readable
LLOC15Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.5620–1; higher is more readable

Views

Source code

package com.google.common.collect; import com.google.common.annotations.GwtCompatible; import java.util.Map.Entry; import java.util.Objects; import org.jspecify.annotations.Nullable; /** * Implementation of the {@code equals}, {@code hashCode}, and {@code toString} methods of {@code * Entry}. * * @author Jared Levy */ @GwtCompatible abstract class AbstractMapEntry<K extends @Nullable Object, V extends @Nullable Object> implements Entry<K, V> { @Override @ParametricNullness public abstract K getKey(); @Override @ParametricNullness public abstract V getValue(); @Override @ParametricNullness public V setValue(@ParametricNullness V value) { throw new UnsupportedOperationException(); } @Override public boolean equals(@Nullable Object object) { if (object instanceof Entry) { Entry<?, ?> that = (Entry<?, ?>) object; return Objects.equals(this.getKey(), that.getKey()) && Objects.equals(this.getValue(), that.getValue()); } return false; } @Override public int hashCode() { K k = getKey(); V v = getValue(); return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode()); } /** Returns a string representation of the form {@code {key}={value}}. */ @Override public String toString() { return getKey() + "=" + getValue(); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.1546.216−51.025
Source linesThe number of non-empty source lines.53+21.2
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.95−7.426

Intercept 8.87 + feature contributions = -28.381 (log-odds).
Score = sigmoid(-28.381) = 0.

Score0.795

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.48+0.923
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.54−0.876
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.95.111+0.73
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.48−0.681
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.96.963−0.442
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.52.704+0.327
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.113−0.154

Intercept 0.07 + feature contributions = -0.102 (log-odds).
Score = sigmoid(-0.102) = 0.474.

Score0.716
Score15
Run 1

The code is well-structured with clear separation of concerns: abstract getters, a default setter throwing UnsupportedOperationException, and overridden equals/hashCode/toString methods. Nesting is minimal (one level in equals). Intent is explicit through method names, Javadoc, and use of Objects.equals. The equals method is concise and correct, used with instanceof pattern and wildcard cast. hashCode follows the standard Entry contract with null checks via ternary operators. toString is a simple one-liner matching its contract. Minor readability improvements could include extracting the null-handling logic into helper methods or using Objects.hashCode, but the current style is consistent and idiomatic for Guava. Overall, the code maintains a natural reading flow and one action per line, with no excessive length or ambiguity.

Run 2

The code is highly readable. It has a clear, logical structure with well-defined methods and concise javadoc. Nesting is minimal, limited to one level in the equals method. Intent is unambiguous, with descriptive method names and targeted override annotations. The implementation is concise without unnecessary verbosity. Each method performs a single action, and the reading flow is natural—declaring abstract getters first, then equals, hashCode, and toString. The use of `Objects.equals` and ternary expressions for null safety is idiomatic and clear. Minor deductions only for the slightly terse `Entry<?, ?> that = (Entry<?, ?>) object;` cast line, which combines declaration and assignment, and for assuming familiarity with Guava annotations, but these do not detract from overall readability.

Run 3

The code is well-structured and readable. The class has a clear single responsibility: implementing Entry methods. Methods are logically ordered (getters, setValue, equals, hashCode, toString) and each is concise. Nesting is minimal—only one level in equals() and none elsewhere. Intent is clear from method names and the class-level Javadoc. The equals method uses a clean instanceof pattern with early return. Action granularity is appropriate: one logical operation per line in most cases, with the equals return spanning two lines for readability. The hashCode method uses local variables to avoid repeated method calls, improving clarity. Type parameters and annotations are standard for Guava. Minor deductions: the import line could be spaced from package declaration, and the ternary expressions in hashCode could be slightly more readable with a helper method, but overall this is exemplary Java collection code.

Run 1

Code Structure: Methods are logically organized around the Map.Entry contract, with clear separation of responsibilities. Nesting: Only one shallow conditional appears in equals, making control flow easy to follow. Clarity of intent: Standard method names, overrides, and documentation clearly convey purpose; the abbreviated k and v variables and compact XOR expression slightly reduce hashCode clarity. Code length: The implementation is concise without unnecessary logic. Action granularity: Each statement performs a focused action, with the multiline equality check remaining readable. Reading flow: Consistent formatting and a natural progression from accessors to mutation behavior and object methods support smooth reading. Nullness annotations add some visual density but communicate useful constraints.

Run 2

Code Structure: Methods are logically organized around the Map.Entry contract, with clear separation of responsibilities. Nesting: Only one shallow conditional appears in equals; other methods are flat. Clarity of intent: Standard method names, overrides, and documentation make the purpose clear, although abbreviated variables k and v and the XOR hash calculation require minor interpretation. Code length: The implementation is concise without unnecessary abstraction or repetition. Action granularity: Each statement performs a focused action; compound expressions remain short and understandable. Reading flow: Consistent formatting and a natural progression from accessors to equality, hashing, and string representation make the code easy to follow. Nullness annotations add slight visual density but communicate useful type constraints.

Run 3

Code Structure: Methods are logically organized in a small, focused class. Nesting: Only one shallow conditional appears in equals; other methods are flat. Clarity of intent: Standard Map.Entry methods, descriptive documentation, and familiar Java idioms make the purpose clear. Code length: The implementation is concise without unnecessary logic. Action granularity: Statements generally perform one action each; the hashCode expression combines two null checks and XOR but remains compact and understandable. Reading flow: Consistent formatting and straightforward method bodies support natural reading. Minor readability drawbacks include abbreviated variable names k and v and the slightly dense hashCode expression.