Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add [SequencedCollection](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/SequencedCollection.html) methods to ImmutableSortedSet. #6796

Closed
wants to merge 1 commit into from

Commits on Oct 21, 2023

  1. Add [SequencedCollection](https://docs.oracle.com/en/java/javase/21…

    …/docs/api/java.base/java/util/SequencedCollection.html) methods to `ImmutableSortedSet`.
    
    There are a couple reasons that this is maybe kind of nice, and then there's my real motivation for doing it.
    
    Reasons that this is maybe kind of nice:
    
    - We add `@DoNotCall` and `@Deprecated` to the mutator methods, as usual.
    - We refine the return type of `reversed()` to `ImmutableSortedSet`.
    
    But again, those aren't my real motivation. (If they _were_ my real motivation, you might notice, then there would be no reason for us to override `getFirst()` and `getLast()`.)
    
    My _real_ motivation is that we are looking to give `guava-android` APIs that use Java 8+ types in their signatures, such as `ImmutableSet.toImmutableSet`. And as a result of some part of those changes, we start seeing errors in some of our Google-internal build rules. Those errors come because some the desugaring process is inserting its own versions of `getFirst` and friends, versions that refer to the desugar-provided copies of `SortedSet` and `NavigableSet`, which our build process then looks for but cannot find.
    
    Since this CL is preparation for adding `ImmutableSet.toImmutableSet`, it constitutes further progress toward #6567
    
    RELNOTES=`collect`: Added [`SequencedCollection`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/SequencedCollection.html) methods to `ImmutableSortedSet`.
    PiperOrigin-RevId: 575207552
    cpovirk authored and Google Java Core Libraries committed Oct 21, 2023
    Configuration menu
    Copy the full SHA
    5ab75bb View commit details
    Browse the repository at this point in the history