Sample

int-7af80496fa35-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines32

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4310–1; higher is more readable
Dorn0.4680–1; higher is more readable
Mi0.0550–1; higher is more readable
LLOC16Logical lines; fewer is more readable
DeepSeek V4 Pro5.670–20; mean of three runs
GPT-6.1 Sol12.330–20; mean of three runs
BTTF0.410–1; higher is more readable

Views

Source code

package com.google.common.collect; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.GwtCompatible; import java.util.Comparator; import java.util.SortedSet; import org.jspecify.annotations.Nullable; /** * Utilities for dealing with sorted collections of all types. * * @author Louis Wasserman */ @GwtCompatible final class SortedIterables { private SortedIterables() {} /** * Returns {@code true} if {@code elements} is a sorted collection using an ordering equivalent to * {@code comparator}. */ public static boolean hasSameComparator(Comparator<?> comparator, Iterable<?> elements) { checkNotNull(comparator); checkNotNull(elements); Comparator<?> comparator2; if (elements instanceof SortedSet) { comparator2 = comparator((SortedSet<?>) elements); } else if (elements instanceof SortedIterable) { comparator2 = ((SortedIterable<?>) elements).comparator(); } else { return false; } return comparator.equals(comparator2); } @SuppressWarnings("unchecked") // if sortedSet.comparator() is null, the set must be naturally ordered public static <E extends @Nullable Object> Comparator<? super E> comparator( SortedSet<E> sortedSet) { Comparator<? super E> result = sortedSet.comparator(); if (result == null) { result = (Comparator<? super E>) Ordering.natural(); } return result; } }

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.1376.306−45.418
Source linesThe number of non-empty source lines.32+12.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.731−7.097

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

Score0.431

Feature contributions

FeatureValueContribution
(log-odds)
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.133−1.968
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.133+1.341
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.33−0.132
Indentation frequencyHow rapidly indentation changes from line to line.24+0.093
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.31.866+0.036
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.093+0.036

Intercept 0.07 + feature contributions = -0.127 (log-odds).
Score = sigmoid(-0.127) = 0.468.

Score0.055
Score16
Run 1

The code suffers from severe readability issues. Multiple statements are crammed onto single lines, making it difficult to distinguish separate actions. Import statements lack proper spacing and alignment. Method bodies are compressed with opening braces sharing lines with conditions, disrupting natural reading flow. The class and method structure is technically logical but visually obscured by poor formatting. Nesting is shallow, which is good, but the lack of line breaks and indentation makes even simple logic hard to follow. The intent is clear once decoded, but the presentation creates unnecessary cognitive load. Code length is appropriately concise, but action granularity is violated with multiple operations per line. Reading flow is completely disrupted by the inconsistent formatting choices.

Run 2

The code has major readability issues. Formatting is inconsistent - multiple statements share lines (e.g., 'if (elements instanceof SortedSet) { comparator2 = comparator((SortedSet<?>) elements);'), and spacing/indentation is erratic with closing braces on the same line as subsequent code. Line breaks are missing after semicolons and before else/return statements, disrupting natural reading flow. Nesting is shallow but hard to follow due to the compressed layout. Method signatures are long, especially the comparator method with inline annotations, adding noise. Intent is somewhat obscured by the poor formatting despite basic variable names being reasonable. The one-line class declaration combines multiple elements ('final class SortedIterables { private SortedIterables() {}') which hurts readability. Action granularity is mixed, with multiple actions packed onto single lines in several places. The reading flow feels disorganized and requires extra effort to mentally parse structure.

Run 3

The code has some structure but suffers from poor formatting and compressed lines. Multiple statements are placed on single lines (e.g., method declarations, if-else branches), reducing readability. Nesting is shallow but the inconsistent indentation and inline conditionals disrupt reading flow. Intent is somewhat clear from comments, but the tangled formatting obscures logic. Code length is reasonable, but action granularity is violated—several actions occur per line. The natural reading flow is broken by compressed blocks and lack of whitespace. Overall, the logic is simple but presentation is poor, making it harder to scan and understand quickly.

Run 1

Code Structure: A focused utility class with two logically separated methods, but compressed declarations and braces obscure boundaries. Nesting: Shallow conditionals keep control flow easy to follow. Clarity of intent: Descriptive method names, documentation, and null checks explain the purpose; comparator2 is less informative. Code length: Appropriately concise, with no substantial redundancy, though excessive line compression harms readability. Action granularity: Several lines combine imports, declarations, conditionals, assignments, or closing braces, making individual actions harder to scan. Reading flow: The comparator-selection logic is natural, but inconsistent spacing and crowded formatting interrupt otherwise straightforward reading.

Run 2

Code Structure: Two focused utility methods provide logical organization, but compressed declarations and braces obscure boundaries. Nesting: Shallow conditional branches are easy to follow. Clarity of intent: Method names, documentation, and the natural-ordering comment explain the purpose well; comparator2 is a weak variable name. Code length: Concise with little unnecessary code, although excessive compression reduces readability. Action granularity: Several lines combine imports, declarations, conditionals, assignments, or returns instead of presenting one action per line. Reading flow: The underlying sequence is natural, but inconsistent whitespace, inline statements, and crowded closing braces interrupt scanning.

Run 3

Code Structure: The utility class has two logically separated methods, but compressed declarations and closing braces obscure their boundaries. Nesting: Shallow conditionals keep the logic easy to follow. Clarity of intent: Method names, documentation, and null checks clearly explain comparator compatibility and natural-order fallback; comparator2 is less descriptive. Code length: The implementation is concise without unnecessary logic, although excessive compression reduces readability. Action granularity: Several lines combine imports, declarations, conditionals, assignments, or returns, making individual actions harder to scan. Reading flow: The execution order is natural, but inconsistent spacing, indentation, and brace placement interrupt reading.