Sample

int-f0653583b290-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines104

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5430–1; higher is more readable
Dorn0.3460–1; higher is more readable
Mi0.3810–1; higher is more readable
LLOC32Logical lines; fewer is more readable
DeepSeek V4 Pro15.670–20; mean of three runs
GPT-6.1 Sol16.330–20; mean of three runs
BTTF0.4220–1; higher is more readable

Views

Source code

package com.google.common.collect; import static com.google.common.collect.Sets.unmodifiableNavigableSet; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.collect.Multisets.UnmodifiableMultiset; import com.google.errorprone.annotations.concurrent.LazyInit; import java.util.Comparator; import java.util.NavigableSet; import org.jspecify.annotations.Nullable; /** * Implementation of {@link Multisets#unmodifiableSortedMultiset(SortedMultiset)}, split out into * its own file so it can be GWT emulated (to deal with the differing elementSet() types in GWT and * non-GWT). * * @author Louis Wasserman */ @GwtCompatible final class UnmodifiableSortedMultiset<E extends @Nullable Object> extends UnmodifiableMultiset<E> implements SortedMultiset<E> { UnmodifiableSortedMultiset(SortedMultiset<E> delegate) { super(delegate); } @Override protected SortedMultiset<E> delegate() { return (SortedMultiset<E>) super.delegate(); } @Override public Comparator<? super E> comparator() { return delegate().comparator(); } @Override NavigableSet<E> createElementSet() { return unmodifiableNavigableSet(delegate().elementSet()); } @Override public NavigableSet<E> elementSet() { return (NavigableSet<E>) super.elementSet(); } @LazyInit private transient @Nullable UnmodifiableSortedMultiset<E> descendingMultiset; // TODO(b/418181860): This method creates retain cycles in J2ObjC. In order to break the cycle, // there needs to be separate classes for primary and descending multiset, where the primary one // would hold {@code @LazyInit @RetainedWith @Nullable} reference to its descending multiset, and // the other {@code final} reference. @Override public SortedMultiset<E> descendingMultiset() { UnmodifiableSortedMultiset<E> result = descendingMultiset; if (!((result == null))) {} else { result = new UnmodifiableSortedMultiset<>(delegate().descendingMultiset()); result.descendingMultiset = this; return descendingMultiset = result; } return result; } @Override public @Nullable Entry<E> firstEntry() { return delegate().firstEntry(); } @Override public @Nullable Entry<E> lastEntry() { return delegate().lastEntry(); } @Override public @Nullable Entry<E> pollFirstEntry() { throw new UnsupportedOperationException(); } @Override public @Nullable Entry<E> pollLastEntry() { throw new UnsupportedOperationException(); } @Override public SortedMultiset<E> headMultiset(@ParametricNullness E upperBound, BoundType boundType) { return Multisets.unmodifiableSortedMultiset(delegate().headMultiset(upperBound, boundType)); } @Override public SortedMultiset<E> subMultiset( @ParametricNullness E lowerBound, BoundType lowerBoundType, @ParametricNullness E upperBound, BoundType upperBoundType) { return Multisets.unmodifiableSortedMultiset( delegate().subMultiset(lowerBound, lowerBoundType, upperBound, upperBoundType)); } @Override public SortedMultiset<E> tailMultiset(@ParametricNullness E lowerBound, BoundType boundType) { return Multisets.unmodifiableSortedMultiset(delegate().tailMultiset(lowerBound, boundType)); } @GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0; }

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.3268.789−107.87
Source linesThe number of non-empty source lines.104+41.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.88−7.321

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

Score0.543

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.105−2.681
Indentation frequencyHow rapidly indentation changes from line to line.94+2.514
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.94−1.736
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.103.86+1.042
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.85+0.567
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.98.914−0.524
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.085+0.113

Intercept 0.07 + feature contributions = -0.636 (log-odds).
Score = sigmoid(-0.636) = 0.346.

Score0.381
Score32
Run 1

The code is generally well-structured, following standard Java/GWT conventions with clear class hierarchy and focused method responsibilities. The main readability issue is in the descendingMultiset() method where the if-else construct is backwards and awkward: 'if (!((result == null))) {} else { ...; return ...; }' makes the flow confusing and non-idiomatic. Additionally, the method mixes lazy initialization, assignment, and return into the else branch, combining multiple actions. Other methods are concise and clear, with good delegation patterns and straightforward type casting. The TODO comment is helpful but adds length. Overall, the code is readable at the class level but has a single method that significantly hurts clarity due to unnatural branching and multiple operations per line.

Run 2

The code is well-structured and follows clear organizational patterns. It has a logical class hierarchy, methods are concise with single responsibilities, and nesting is minimal. Naming is descriptive, and the delegation pattern is clear. One section (descendingMultiset) has an unusual if-else construct that disrupts reading flow and could be more straightforward. Overall, the code is highly readable for experienced Java developers, though the odd conditional slightly reduces clarity.

Run 3

The code is generally well-structured and readable. It has clear naming conventions, logical organization, and flat nesting for most methods. The class hierarchy and overrides are straightforward. However, readability is affected by the `descendingMultiset()` method which contains an awkward inverted if-else condition (`if (!((result == null))) {} else {...}`) that disrupts natural reading flow. Additionally, the TODO comment about retain cycles introduces some complexity. The code is concise and each method has a single responsibility, but the `descendingMultiset` logic could be clearer. Overall, this is readable production code with minor stylistic issues.

Run 1

Code Structure: Well-organized wrapper class with small, focused overrides; the cached field appears mid-class but near its use. Nesting: Shallow throughout, although descendingMultiset() uses an awkward empty if branch and else. Clarity of intent: Class documentation, descriptive names, delegation, and explicit unsupported operations clearly express an unmodifiable sorted multiset. The negated, over-parenthesized null check obscures otherwise simple lazy initialization. Code length: Appropriately concise; repetitive forwarding methods are justified by the interface. Action granularity: Mostly one action per line, but return descendingMultiset = result combines caching and returning. Reading flow: Consistent formatting and related method groupings support easy scanning. The empty branch, inverted condition, and combined assignment/return interrupt the otherwise natural flow.

Run 2

Code Structure: Well-organized wrapper class with small, focused overrides and clear delegation. Nesting: Shallow throughout, though descendingMultiset() uses an awkward empty if branch and else block. Clarity of intent: Descriptive names and documentation establish the unmodifiable-wrapper purpose; the negated, redundantly parenthesized null check obscures straightforward lazy initialization. Code length: Mostly concise, with necessary interface implementations; the empty branch adds needless syntax. Action granularity: Most lines perform one action, but returning an assignment combines caching and returning in one statement. Reading flow: Consistent formatting and predictable delegation make most methods easy to scan, while the unusual conditional interrupts the flow. Dense annotation placement and the detailed platform-specific TODO add minor visual complexity.

Run 3

Code Structure: Well-organized wrapper class with small, focused methods and consistent delegation. Nesting: Minimal nesting, although descendingMultiset() unnecessarily uses an empty if branch followed by else. Clarity of intent: Descriptive names, overrides, and documentation clearly convey an unmodifiable sorted multiset; the negated, redundantly parenthesized null check obscures straightforward lazy initialization. Code length: Generally concise, with necessary interface implementations and useful compatibility documentation. Action granularity: Most lines perform one action, but return descendingMultiset = result combines assignment and return. Reading flow: Consistent formatting and method patterns support easy scanning, though the awkward conditional, mid-class cache field, and compressed annotations slightly interrupt the flow.