Sample

int-15b85e1bc4ce-I13

Lower every eligible classic and enhanced for loop to a while loop

Matched original source

Lines31

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Scalabrino0.7460–1; higher is more readable
Dorn0.7140–1; higher is more readable
Mi0.3510–1; higher is more readable
LLOC5Logical lines; fewer is more readable
DeepSeek V4 Pro180–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.6720–1; higher is more readable

Views

Source code

package com.google.common.cache; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.GwtIncompatible; import java.util.concurrent.Executor; /** * A collection of common removal listeners. * * @author Charles Fry * @since 10.0 */ @GwtIncompatible public final class RemovalListeners { private RemovalListeners() {} /** * Returns a {@code RemovalListener} which processes all eviction notifications using {@code * executor}. * * @param listener the backing listener * @param executor the executor with which removal notifications are asynchronously executed */ public static <K, V> RemovalListener<K, V> asynchronous( RemovalListener<K, V> listener, Executor executor) { checkNotNull(listener); checkNotNull(executor); return (RemovalNotification<K, V> notification) -> executor.execute(() -> listener.onRemoval(notification)); } }

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.647.078−21.354
Source linesThe number of non-empty source lines.31+12.4
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.756−7.134

Intercept 8.87 + feature contributions = -7.217 (log-odds).
Score = sigmoid(-7.217) = 0.001.

Score0.746

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.88.25+0.619
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.94−0.316
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.07+0.266
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.32−0.097
Indentation frequencyHow rapidly indentation changes from line to line.20−0.045
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.30.832+0.021

Intercept 0.07 + feature contributions = 0.916 (log-odds).
Score = sigmoid(0.916) = 0.714.

Score0.351
Score5
Run 1

The code is highly readable. Structure is logical: package, imports, Javadoc, class definition, single static factory method. Nesting is minimal—only a lambda within a lambda, but both are simple. Clarity of intent is strong due to clear naming ('asynchronous', 'listener', 'executor') and comprehensive Javadoc. Code length is concise and appropriate, with no redundant boilerplate. Action granularity is mostly one action per line; the lambda bodies are compact but still understandable. Reading flow is natural: validation first, then return of the composed listener. Minor deductions: the static import is used correctly, and the inner lambda could arguably be extracted for absolute clarity, but current form is acceptable. Overall, this is exemplary Java library code.

Run 2

The code is highly readable. Structure is logical and minimal, with clear class and method organization. There is almost no nesting: the only lambda is flat and concise. Intent is explicit through meaningful names, Javadoc, and preconditions. Code length is appropriate, with no redundancy. Each action (validation, lambda creation, executor call) is separated cleanly. Reading flow is natural from top to bottom, with comments placed logically. Minor deductions: static import and class-level annotations slightly reduce immediate context for newer Java developers, but overall this is a strong example of clean, maintainable code.

Run 3

The code is highly readable. Its structure is logical, with a clear separation between class definition, constructor privacy, and the public API method. Nesting is minimal; only one level of lambda nesting appears in the asynchronous method. The intent is obvious from the method name and Javadoc. The code is concise without being cryptic, using a single functional statement to return the listener. Each meaningful action, such as validation checks and executor invocation, is on its own line. The reading flow is natural, progressing from preconditions to the returned behavior. Minor deductions are for the slightly complex double-lambda expression, which could be marginally clearer with a named method reference, but overall the code is excellent.

Run 1

Code Structure: A well-organized utility class contains a single focused factory method and a private constructor. Nesting: Minimal nesting; the two lambdas clearly express asynchronous delegation. Clarity of intent: Descriptive names, documentation, and explicit null checks make the purpose clear, though 'eviction notifications' is slightly narrower than removal notifications. Code length: Concise without unnecessary implementation detail. Action granularity: Each validation occupies its own line, and the return expression performs one cohesive operation. Reading flow: Naturally progresses from documentation and signature to validation and listener construction. Minor formatting improvements, such as separating the package declaration from imports, would improve readability.

Run 2

Code Structure: The utility class is logically organized, with a private constructor and a single focused public method. Nesting: Minimal nesting; the nested lambdas are compact and straightforward. Clarity of intent: Descriptive names, documentation, and explicit null checks clearly communicate asynchronous notification handling. Code length: Concise, with no unnecessary implementation details. Action granularity: Each validation occupies its own line, and the return expression performs one cohesive delegation operation. Reading flow: Natural progression from documentation and method signature to validation and execution. Minor drawbacks are tightly grouped package/import declarations and a nested lambda that requires slightly more attention than a simple method call.

Run 3

Code Structure: A well-organized utility class with a private constructor and one focused factory method. Nesting: Minimal nesting; the two lambdas compactly express asynchronous delegation. Clarity of intent: Descriptive names, documentation, and explicit null checks make the purpose clear. Code length: Concise without unnecessary logic or boilerplate. Action granularity: Each validation occupies its own line, while the return expression combines closely related scheduling and callback actions appropriately. Reading flow: Natural progression from documentation to validation to listener creation. Minor drawbacks are tightly grouped package/import declarations and a nested lambda expression that may require a second glance.