Sample

int-311f1c2f7b79-I10

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

Matched original source

Lines94

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4080–1; higher is more readable
Dorn0.1090–1; higher is more readable
Mi00–1; higher is more readable
LLOC53Logical lines; fewer is more readable
DeepSeek V4 Pro6.330–20; mean of three runs
GPT-6.1 Sol11.330–20; mean of three runs
BTTF0.2220–1; higher is more readable

Views

Source code

package com.google.common.collect; import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.concurrent.LazyInit; import com.google.j2objc.annotations.WeakOuter; import java.util.Comparator; import java.util.Iterator; import java.util.NavigableSet; import java.util.Set; import org.jspecify.annotations.Nullable; /** * A skeleton implementation of a descending multiset. Only needs {@code forwardMultiset()} and * {@code entryIterator()}. * * @author Louis Wasserman */ @GwtCompatible abstract class DescendingMultiset<E extends @Nullable Object> extends ForwardingMultiset<E> implements SortedMultiset<E> { abstract SortedMultiset<E> forwardMultiset(); @LazyInit private transient @Nullable Comparator<? super E> comparator; @Override public Comparator<? super E> comparator() { Comparator<? super E> result = comparator; if (result == null) { result = Ordering.from(forwardMultiset().comparator()).reverse(); comparator = result; } return result; } @LazyInit private transient @Nullable NavigableSet<E> elementSet; @Override public NavigableSet<E> elementSet() { NavigableSet<E> result = elementSet; if (result == null) { return elementSet = new SortedMultisets.NavigableElementSet<>(this); } return result; } @Override public @Nullable Entry<E> pollFirstEntry() { return forwardMultiset().pollLastEntry(); } @Override public @Nullable Entry<E> pollLastEntry() { return forwardMultiset().pollFirstEntry(); } @Override public SortedMultiset<E> headMultiset(@ParametricNullness E toElement, BoundType boundType) { return forwardMultiset().tailMultiset(toElement, boundType).descendingMultiset(); } @Override public SortedMultiset<E> subMultiset( @ParametricNullness E fromElement, BoundType fromBoundType, @ParametricNullness E toElement, BoundType toBoundType) { return forwardMultiset() .subMultiset(toElement, toBoundType, fromElement, fromBoundType) .descendingMultiset(); } @Override public SortedMultiset<E> tailMultiset(@ParametricNullness E fromElement, BoundType boundType) { return forwardMultiset().headMultiset(fromElement, boundType).descendingMultiset(); } @Override protected Multiset<E> delegate() { return forwardMultiset(); } @Override public SortedMultiset<E> descendingMultiset() { return forwardMultiset(); } @Override public @Nullable Entry<E> firstEntry() { return forwardMultiset().lastEntry(); } @Override public @Nullable Entry<E> lastEntry() { return forwardMultiset().firstEntry(); } abstract Iterator<Entry<E>> entryIterator(); @LazyInit private transient @Nullable Set<Entry<E>> entrySet; @Override public Set<Entry<E>> entrySet() { Set<Entry<E>> result = entrySet; return (result == null) ? entrySet = createEntrySet() : result; } Set<Entry<E>> createEntrySet() { @WeakOuter final class EntrySetImpl extends Multisets.EntrySet<E> { @Override Multiset<E> multiset() { return DescendingMultiset.this; } @Override public Iterator<Entry<E>> iterator() { return entryIterator(); } @Override public int size() { return forwardMultiset().entrySet().size(); } } return new EntrySetImpl(); } @Override public Iterator<E> iterator() { return Multisets.iteratorImpl(this); } @Override public @Nullable Object[] toArray() { return standardToArray(); } @Override @SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations public <T extends @Nullable Object> T[] toArray(T[] array) { return standardToArray(array); } @Override public String toString() { return entrySet().toString(); } }

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.4612.687−152.219
Source linesThe number of non-empty source lines.94+37.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.857−7.286

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

Score0.408

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.234−6.246
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.234+2.971
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.95−2.327
Indentation frequencyHow rapidly indentation changes from line to line.87+2.272
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.93.711+0.9
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.111−0.135

Intercept 0.07 + feature contributions = -2.097 (log-odds).
Score = sigmoid(-2.097) = 0.109.

Score0
Score53
Run 1

The code exhibits poor readability despite being logically organized at the method level. Multiple statements are crammed onto single lines (e.g., field declarations, method signatures, and bodies), violating the 'one action per line' principle and disrupting natural reading flow. Nesting is mostly flat, which is positive, but the lack of line breaks makes the structure difficult to parse. Intent is somewhat clear through descriptive method names, but the visual clutter obscures it. The code is unnecessarily long due to compact formatting rather than actual verbosity. The action granularity criterion is severely violated—several lines combine 3-4 distinct operations. While the underlying logic follows a reasonable delegation pattern, the formatting makes it feel tangled and hard to scan. Proper line breaks, indentation, and separating declarations from statements would dramatically improve readability.

Run 2

The code suffers from multiple readability issues. Structure is tangled with multiple method declarations on single lines, making it hard to scan. Imports and method signatures are compressed together, violating one-action-per-line principles. While the class purpose is clear from documentation, the implementation obscures intent through inconsistent formatting - some methods are properly spaced while others are crammed on one line. Nesting is acceptable in the EntrySetImpl inner class but mid-line method chaining disrupts flow. The overall reading experience requires constant mental reformatting to understand logic. The code appears functional but prioritizes brevity over clarity, with extreme compression that hurts maintainability.

Run 3

The code suffers from severe readability issues. Multiple statements are crammed onto single lines, violating the 'one action per line' principle and disrupting natural reading flow. Method declarations and implementations are frequently combined on the same line, making it difficult to distinguish structure. Import statements are also compressed onto one line. While the class has a clear purpose as a descending multiset implementation, the formatting obscures the logical organization that should be apparent from the method structure. The lazy initialization pattern is recognizable but rendered less clear by the compressed formatting. Nesting is relatively shallow, which is positive, but the lack of proper line breaks undermines this advantage. The code would be significantly more readable with standard Java formatting conventions applied consistently.

Run 1

Code Structure: Methods are logically grouped around descending-multiset delegation, caching, and collection views, but compressed declarations obscure boundaries. Nesting: Mostly flat, with simple conditionals and one local class; nesting is manageable. Clarity of intent: Descriptive method names, a useful class comment, and straightforward reversed delegation communicate purpose, though inline cache assignments require extra attention. Code length: Concise overall, with little unnecessary logic, but excessive compression sacrifices readability. Action granularity: Multiple imports, fields, annotations, methods, and statements share lines, making individual actions harder to distinguish. Reading flow: Inconsistent line breaks, brace placement, and spacing interrupt scanning, particularly between adjacent methods. The implementation is conceptually clear, but formatting substantially reduces readability.

Run 2

Code Structure: Methods form a logically organized descending-multiset wrapper, but compressed declarations obscure boundaries between fields and methods. Nesting: Mostly shallow; lazy-initialization conditionals and a small local class are easy to follow. Clarity of intent: Descriptive names, documentation, and straightforward delegation clearly express reversed ordering and cached views. Code length: Concise, with little unnecessary logic, although extreme compression reduces scanability. Action granularity: Multiple imports, declarations, statements, and entire methods share lines; the assignment inside a conditional return also combines actions. Reading flow: Inconsistent spacing, brace placement, annotation layout, and method-chain formatting repeatedly interrupt reading. The underlying implementation is understandable, but poor formatting substantially weakens readability.

Run 3

Code Structure: Responsibilities are logically separated into delegation, reversed ordering, cached views, and iteration, but compressed declarations obscure boundaries. Nesting: Mostly shallow; the local EntrySetImpl class adds modest, manageable nesting. Clarity of intent: Descriptive method names, standard overrides, and the class documentation clearly communicate descending-multiset behavior, although compact cache initialization expressions require closer reading. Code length: Concise, with little unnecessary logic or duplication. Action granularity: Multiple imports, fields, methods, and statements share lines, making individual actions harder to distinguish. Reading flow: Inconsistent indentation, crowded annotations, misplaced closing braces, and irregular method-chain spacing interrupt scanning. Overall, the implementation is conceptually clear and well organized, but its formatting substantially reduces readability.