    /**
     * Returns an {@code ImmutableRangeSet} containing the ranges added to this builder.
     *
     * @throws IllegalArgumentException if any input ranges have nonempty overlap
     */
    public ImmutableRangeSet<C> build() {
      ImmutableList.Builder<Range<C>> mergedRangesBuilder =
          new ImmutableList.Builder<>(ranges.size());
      Collections.sort(ranges, Range.<C>rangeLexOrdering());
      PeekingIterator<Range<C>> peekingItr = Iterators.peekingIterator(ranges.iterator());
      while (peekingItr.hasNext()) {
        Range<C> range = peekingItr.next();
        while (peekingItr.hasNext()) {
          Range<C> nextRange = peekingItr.peek();
          if (range.isConnected(nextRange)) {
            checkArgument(
                range.intersection(nextRange).isEmpty(),
                "Overlapping ranges not permitted but found %s overlapping %s",
                range,
                nextRange);
            range = range.span(peekingItr.next());
          } else {
            break;
          }
        }
        mergedRangesBuilder.add(range);
      }
      ImmutableList<Range<C>> mergedRanges = mergedRangesBuilder.build();
      if (mergedRanges.isEmpty()) {
        return of();
      } else if (mergedRanges.size() == 1
          && Iterables.getOnlyElement(mergedRanges).equals(Range.all())) {
        return all();
      } else {
        return new ImmutableRangeSet<>(mergedRanges);
      }
    }

    /**
     * Returns an {@code ImmutableRangeSet} containing the ranges added to this builder.
     *
     * @throws IllegalArgumentException if any input ranges have nonempty overlap
     */
    public ImmutableRangeSet<C> build() {
      ImmutableList.Builder<Range<C>> mergedRangesBuilder =
          new ImmutableList.Builder<>(ranges.size());
      Collections.sort(ranges, Range.<C>rangeLexOrdering());
      PeekingIterator<Range<C>> peekingItr = Iterators.peekingIterator(ranges.iterator());
      while (peekingItr.hasNext()) {
        Range<C> range = peekingItr.next();
        while (peekingItr.hasNext()) {
          Range<C> nextRange = peekingItr.peek();
          if (range.isConnected(nextRange)) {
            checkArgument(
                range.intersection(nextRange).isEmpty(),
                "Overlapping ranges not permitted but found %s overlapping %s",
                range,
                nextRange);
            range = range.span(peekingItr.next());
          } else {
            break;
          }
        }
        mergedRangesBuilder.add(range);
      }
      ImmutableList<Range<C>> mergedRanges = mergedRangesBuilder.build();
      if (mergedRanges.isEmpty()) {
        return of();
      } else if (mergedRanges.size() == 1
          && Iterables.getOnlyElement(mergedRanges).equals(Range.all())) {
        return all();
      } else {
        return new ImmutableRangeSet<C>(mergedRanges);
      }
    }

Replace Generic With Diamond ImmutableRangeSet<C> with ImmutableRangeSet<> in method public build() : ImmutableRangeSet<C> from class dev.mccue.guava.collect.ImmutableRangeSet.Builder


  /**
   * Returns an immutable range set containing the specified single range. If {@code Range#isEmpty()
   * range.isEmpty()}, this is equivalent to {@code ImmutableRangeSet#of()}.
   */
  public static <C extends Comparable> ImmutableRangeSet<C> of(Range<C> range) {
    checkNotNull(range);
    if (range.isEmpty()) {
      return of();
    } else if (range.equals(Range.all())) {
      return all();
    } else {
      return new ImmutableRangeSet<>(ImmutableList.of(range));
    }
  }

  /**
   * Returns an immutable range set containing the specified single range. If {@code Range#isEmpty()
   * range.isEmpty()}, this is equivalent to {@code ImmutableRangeSet#of()}.
   */
  public static <C extends Comparable> ImmutableRangeSet<C> of(Range<C> range) {
    checkNotNull(range);
    if (range.isEmpty()) {
      return of();
    } else if (range.equals(Range.all())) {
      return all();
    } else {
      return new ImmutableRangeSet<C>(ImmutableList.of(range));
    }
  }

Replace Generic With Diamond ImmutableRangeSet<C> with ImmutableRangeSet<> in method public of(range Range<C>) : ImmutableRangeSet<C> from class dev.mccue.guava.collect.ImmutableRangeSet


  /** Returns an immutable copy of the specified {@code RangeSet}. */
  public static <C extends Comparable> ImmutableRangeSet<C> copyOf(RangeSet<C> rangeSet) {
    checkNotNull(rangeSet);
    if (rangeSet.isEmpty()) {
      return of();
    } else if (rangeSet.encloses(Range.<C>all())) {
      return all();
    }

    if (rangeSet instanceof ImmutableRangeSet) {
      ImmutableRangeSet<C> immutableRangeSet = (ImmutableRangeSet<C>) rangeSet;
      if (!immutableRangeSet.isPartialView()) {
        return immutableRangeSet;
      }
    }
    return new ImmutableRangeSet<>(ImmutableList.copyOf(rangeSet.asRanges()));
  }

  /** Returns an immutable copy of the specified {@code RangeSet}. */
  public static <C extends Comparable> ImmutableRangeSet<C> copyOf(RangeSet<C> rangeSet) {
    checkNotNull(rangeSet);
    if (rangeSet.isEmpty()) {
      return of();
    } else if (rangeSet.encloses(Range.<C>all())) {
      return all();
    }

    if (rangeSet instanceof ImmutableRangeSet) {
      ImmutableRangeSet<C> immutableRangeSet = (ImmutableRangeSet<C>) rangeSet;
      if (!immutableRangeSet.isPartialView()) {
        return immutableRangeSet;
      }
    }
    return new ImmutableRangeSet<C>(ImmutableList.copyOf(rangeSet.asRanges()));
  }

Replace Generic With Diamond ImmutableRangeSet<C> with ImmutableRangeSet<> in method public copyOf(rangeSet RangeSet<C>) : ImmutableRangeSet<C> from class dev.mccue.guava.collect.ImmutableRangeSet


  @Override
  public ImmutableRangeSet<C> complement() {
    ImmutableRangeSet<C> result = complement;
    if (result != null) {
      return result;
    } else if (ranges.isEmpty()) {
      return complement = all();
    } else if (ranges.size() == 1 && ranges.get(0).equals(Range.all())) {
      return complement = of();
    } else {
      ImmutableList<Range<C>> complementRanges = new ComplementRanges();
      result = complement = new ImmutableRangeSet<>(complementRanges, this);
    }
    return result;
  }

  @Override
  public ImmutableRangeSet<C> complement() {
    ImmutableRangeSet<C> result = complement;
    if (result != null) {
      return result;
    } else if (ranges.isEmpty()) {
      return complement = all();
    } else if (ranges.size() == 1 && ranges.get(0).equals(Range.all())) {
      return complement = of();
    } else {
      ImmutableList<Range<C>> complementRanges = new ComplementRanges();
      result = complement = new ImmutableRangeSet<C>(complementRanges, this);
    }
    return result;
  }

Replace Generic With Diamond ImmutableRangeSet<C> with ImmutableRangeSet<> in method public complement() : ImmutableRangeSet<C> from class dev.mccue.guava.collect.ImmutableRangeSet


  /** Returns a view of the intersection of this range set with the given range. */
  @Override
  public ImmutableRangeSet<C> subRangeSet(Range<C> range) {
    if (!isEmpty()) {
      Range<C> span = span();
      if (range.encloses(span)) {
        return this;
      } else if (range.isConnected(span)) {
        return new ImmutableRangeSet<>(intersectRanges(range));
      }
    }
    return of();
  }

  /** Returns a view of the intersection of this range set with the given range. */
  @Override
  public ImmutableRangeSet<C> subRangeSet(Range<C> range) {
    if (!isEmpty()) {
      Range<C> span = span();
      if (range.encloses(span)) {
        return this;
      } else if (range.isConnected(span)) {
        return new ImmutableRangeSet<C>(intersectRanges(range));
      }
    }
    return of();
  }

Replace Generic With Diamond ImmutableRangeSet<C> with ImmutableRangeSet<> in method public subRangeSet(range Range<C>) : ImmutableRangeSet<C> from class dev.mccue.guava.collect.ImmutableRangeSet


  /** Returns a new builder for an immutable range set. */
  public static <C extends Comparable<?>> Builder<C> builder() {
    return new Builder<>();
  }

  /** Returns a new builder for an immutable range set. */
  public static <C extends Comparable<?>> Builder<C> builder() {
    return new Builder<C>();
  }

Replace Generic With Diamond Builder<C> with Builder<> in method public builder() : Builder<C> from class dev.mccue.guava.collect.ImmutableRangeSet


    ImmutableList<E> createAsList() {
      return new RegularImmutableAsList<>(this, toArray());
    }

    ImmutableList<E> createAsList() {
      return new RegularImmutableAsList<E>(this, toArray());
    }

Replace Generic With Diamond RegularImmutableAsList<E> with RegularImmutableAsList<> in method package createAsList() : ImmutableList<E> from class dev.mccue.guava.collect.ImmutableSet.CachingAsList


    Builder(int capacity) {
      if (capacity > 0) {
        impl = new RegularSetBuilderImpl<>(capacity);
      } else {
        impl = EmptySetBuilderImpl.instance();
      }
    }

    Builder(int capacity) {
      if (capacity > 0) {
        impl = new RegularSetBuilderImpl<E>(capacity);
      } else {
        impl = EmptySetBuilderImpl.instance();
      }
    }

Replace Generic With Diamond RegularSetBuilderImpl<E> with RegularSetBuilderImpl<> in method package Builder(capacity int) from class dev.mccue.guava.collect.ImmutableSet.Builder


    void forceJdk() {
      requireNonNull(impl); // see the comment on the field
      this.impl = new JdkBackedSetBuilderImpl<>(impl);
    }

    void forceJdk() {
      requireNonNull(impl); // see the comment on the field
      this.impl = new JdkBackedSetBuilderImpl<E>(impl);
    }

Replace Generic With Diamond JdkBackedSetBuilderImpl<E> with JdkBackedSetBuilderImpl<> in method package forceJdk() : void from class dev.mccue.guava.collect.ImmutableSet.Builder


    @Override
    SetBuilderImpl<E> copy() {
      return new RegularSetBuilderImpl<>(this);
    }

    @Override
    SetBuilderImpl<E> copy() {
      return new RegularSetBuilderImpl<E>(this);
    }

Replace Generic With Diamond RegularSetBuilderImpl<E> with RegularSetBuilderImpl<> in method package copy() : SetBuilderImpl<E> from class dev.mccue.guava.collect.ImmutableSet.RegularSetBuilderImpl


    @Override
    ImmutableSet<E> build() {
      switch (distinct) {
        case 0:
          return of();
        case 1:
          /*
           * requireNonNull is safe because we ensure that the first `distinct` elements have been
           * populated.
           */
          return of(requireNonNull(dedupedElements[0]));
        default:
          /*
           * The suppression is safe because we ensure that the first `distinct` elements have been
           * populated.
           */
          @SuppressWarnings("nullness")
          Object[] elements =
              (distinct == dedupedElements.length)
                  ? dedupedElements
                  : Arrays.copyOf(dedupedElements, distinct);
          return new RegularImmutableSet<>(
              elements, hashCode, requireNonNull(hashTable), hashTable.length - 1);
      }
    }

    @Override
    ImmutableSet<E> build() {
      switch (distinct) {
        case 0:
          return of();
        case 1:
          /*
           * requireNonNull is safe because we ensure that the first `distinct` elements have been
           * populated.
           */
          return of(requireNonNull(dedupedElements[0]));
        default:
          /*
           * The suppression is safe because we ensure that the first `distinct` elements have been
           * populated.
           */
          @SuppressWarnings("nullness")
          Object[] elements =
              (distinct == dedupedElements.length)
                  ? dedupedElements
                  : Arrays.copyOf(dedupedElements, distinct);
          return new RegularImmutableSet<E>(
              elements, hashCode, requireNonNull(hashTable), hashTable.length - 1);
      }
    }

Replace Generic With Diamond RegularImmutableSet<E> with RegularImmutableSet<> in method package build() : ImmutableSet<E> from class dev.mccue.guava.collect.ImmutableSet.RegularSetBuilderImpl


    @Override
    ImmutableSet<E> build() {
      switch (distinct) {
        case 0:
          return of();
        case 1:
          /*
           * requireNonNull is safe because we ensure that the first `distinct` elements have been
           * populated.
           */
          return of(requireNonNull(dedupedElements[0]));
        default:
          return new JdkBackedImmutableSet<>(
              delegate, ImmutableList.asImmutableList(dedupedElements, distinct));
      }
    }

    @Override
    ImmutableSet<E> build() {
      switch (distinct) {
        case 0:
          return of();
        case 1:
          /*
           * requireNonNull is safe because we ensure that the first `distinct` elements have been
           * populated.
           */
          return of(requireNonNull(dedupedElements[0]));
        default:
          return new JdkBackedImmutableSet<E>(
              delegate, ImmutableList.asImmutableList(dedupedElements, distinct));
      }
    }

Replace Generic With Diamond JdkBackedImmutableSet<E> with JdkBackedImmutableSet<> in method package build() : ImmutableSet<E> from class dev.mccue.guava.collect.ImmutableSet.JdkBackedSetBuilderImpl


  /**
   * Returns an immutable set containing {@code element}. Preferred over {@code
   * Collections#singleton} for code consistency, {@code null} rejection, and because the return
   * type conveys the immutability guarantee.
   */
  public static <E> ImmutableSet<E> of(E element) {
    return new SingletonImmutableSet<>(element);
  }

  /**
   * Returns an immutable set containing {@code element}. Preferred over {@code
   * Collections#singleton} for code consistency, {@code null} rejection, and because the return
   * type conveys the immutability guarantee.
   */
  public static <E> ImmutableSet<E> of(E element) {
    return new SingletonImmutableSet<E>(element);
  }

Replace Generic With Diamond SingletonImmutableSet<E> with SingletonImmutableSet<> in method public of(element E) : ImmutableSet<E> from class dev.mccue.guava.collect.ImmutableSet


  /**
   * Returns an immutable set containing the given elements, minus duplicates, in the order each was
   * first specified. That is, if multiple elements are {@code Object#equals equal}, all except
   * the first are ignored.
   *
   * <p>The array {@code others} must not be longer than {@code Integer.MAX_VALUE - 6}.
   *
   * @since 3.0 (source-compatible since 2.0)
   */
  @SafeVarargs // For Eclipse. For internal javac we have disabled this pointless type of warning.
  public static <E> ImmutableSet<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... others) {
    checkArgument(
        others.length <= Integer.MAX_VALUE - 6, "the total number of elements must fit in an int");
    SetBuilderImpl<E> builder = new RegularSetBuilderImpl<>(6 + others.length);
    builder = builder.add(e1).add(e2).add(e3).add(e4).add(e5).add(e6);
    for (int i = 0; i < others.length; i++) {
      builder = builder.add(others[i]);
    }
    return builder.review().build();
  }

  /**
   * Returns an immutable set containing the given elements, minus duplicates, in the order each was
   * first specified. That is, if multiple elements are {@code Object#equals equal}, all except
   * the first are ignored.
   *
   * <p>The array {@code others} must not be longer than {@code Integer.MAX_VALUE - 6}.
   *
   * @since 3.0 (source-compatible since 2.0)
   */
  @SafeVarargs // For Eclipse. For internal javac we have disabled this pointless type of warning.
  public static <E> ImmutableSet<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... others) {
    checkArgument(
        others.length <= Integer.MAX_VALUE - 6, "the total number of elements must fit in an int");
    SetBuilderImpl<E> builder = new RegularSetBuilderImpl<E>(6 + others.length);
    builder = builder.add(e1).add(e2).add(e3).add(e4).add(e5).add(e6);
    for (int i = 0; i < others.length; i++) {
      builder = builder.add(others[i]);
    }
    return builder.review().build();
  }

Replace Generic With Diamond RegularSetBuilderImpl<E> with RegularSetBuilderImpl<> in method public of(e1 E, e2 E, e3 E, e4 E, e5 E, e6 E, others E...) : ImmutableSet<E> from class dev.mccue.guava.collect.ImmutableSet


  private static <E> ImmutableSet<E> fromArrayWithExpectedSize(E[] elements, int expectedSize) {
    switch (elements.length) {
      case 0:
        return of();
      case 1:
        return of(elements[0]);
      default:
        SetBuilderImpl<E> builder = new RegularSetBuilderImpl<>(expectedSize);
        for (int i = 0; i < elements.length; i++) {
          builder = builder.add(elements[i]);
        }
        return builder.review().build();
    }
  }

  private static <E> ImmutableSet<E> fromArrayWithExpectedSize(E[] elements, int expectedSize) {
    switch (elements.length) {
      case 0:
        return of();
      case 1:
        return of(elements[0]);
      default:
        SetBuilderImpl<E> builder = new RegularSetBuilderImpl<E>(expectedSize);
        for (int i = 0; i < elements.length; i++) {
          builder = builder.add(elements[i]);
        }
        return builder.review().build();
    }
  }

Replace Generic With Diamond RegularSetBuilderImpl<E> with RegularSetBuilderImpl<> in method private fromArrayWithExpectedSize(elements E[], expectedSize int) : ImmutableSet<E> from class dev.mccue.guava.collect.ImmutableSet


/**
   * Returns a new builder, expecting the specified number of distinct elements to be added.
   *
   *
If {@code expectedSize} is exactly the number of distinct elements added to the builder
   * before {@code Builder#build} is called, the builder is likely to perform better than an unsized
   * {@code #builder()} would have.
   *
   *
It is not specified if any performance benefits apply if {@code expectedSize} is close to,
   * but not exactly, the number of distinct elements added to the builder.
   *
   * @since 23.1
   */
  public static <E> Builder<E> builderWithExpectedSize(int expectedSize) {
    checkNonnegative(expectedSize, "expectedSize");
    return new Builder<>(expectedSize);
  }

/**
   * Returns a new builder, expecting the specified number of distinct elements to be added.
   *
   *
If {@code expectedSize} is exactly the number of distinct elements added to the builder
   * before {@code Builder#build} is called, the builder is likely to perform better than an unsized
   * {@code #builder()} would have.
   *
   *
It is not specified if any performance benefits apply if {@code expectedSize} is close to,
   * but not exactly, the number of distinct elements added to the builder.
   *
   * @since 23.1
   */
  public static <E> Builder<E> builderWithExpectedSize(int expectedSize) {
    checkNonnegative(expectedSize, "expectedSize");
    return new Builder<E>(expectedSize);
  }

Replace Generic With Diamond Builder<E> with Builder<> in method public builderWithExpectedSize(expectedSize int) : Builder<E> from class dev.mccue.guava.collect.ImmutableSet


  /** Returns an immutable sorted multiset containing a single element. */
  public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E element) {
    RegularImmutableSortedSet<E> elementSet =
        (RegularImmutableSortedSet<E>) ImmutableSortedSet.of(element);
    long[] cumulativeCounts = {0, 1};
    return new RegularImmutableSortedMultiset<>(elementSet, cumulativeCounts, 0, 1);
  }

  /** Returns an immutable sorted multiset containing a single element. */
  public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E element) {
    RegularImmutableSortedSet<E> elementSet =
        (RegularImmutableSortedSet<E>) ImmutableSortedSet.of(element);
    long[] cumulativeCounts = {0, 1};
    return new RegularImmutableSortedMultiset<E>(elementSet, cumulativeCounts, 0, 1);
  }

Replace Generic With Diamond RegularImmutableSortedMultiset<E> with RegularImmutableSortedMultiset<> in method public of(element E) : ImmutableSortedMultiset<E> from class dev.mccue.guava.collect.ImmutableSortedMultiset


  private static <E> ImmutableSortedMultiset<E> copyOfSortedEntries(
      Comparator<? super E> comparator, Collection<Entry<E>> entries) {
    if (entries.isEmpty()) {
      return emptyMultiset(comparator);
    }
    ImmutableList.Builder<E> elementsBuilder = new ImmutableList.Builder<>(entries.size());
    long[] cumulativeCounts = new long[entries.size() + 1];
    int i = 0;
    for (Entry<E> entry : entries) {
      elementsBuilder.add(entry.getElement());
      cumulativeCounts[i + 1] = cumulativeCounts[i] + entry.getCount();
      i++;
    }
    return new RegularImmutableSortedMultiset<>(
        new RegularImmutableSortedSet<E>(elementsBuilder.build(), comparator),
        cumulativeCounts,
        0,
        entries.size());
  }

  private static <E> ImmutableSortedMultiset<E> copyOfSortedEntries(
      Comparator<? super E> comparator, Collection<Entry<E>> entries) {
    if (entries.isEmpty()) {
      return emptyMultiset(comparator);
    }
    ImmutableList.Builder<E> elementsBuilder = new ImmutableList.Builder<E>(entries.size());
    long[] cumulativeCounts = new long[entries.size() + 1];
    int i = 0;
    for (Entry<E> entry : entries) {
      elementsBuilder.add(entry.getElement());
      cumulativeCounts[i + 1] = cumulativeCounts[i] + entry.getCount();
      i++;
    }
    return new RegularImmutableSortedMultiset<E>(
        new RegularImmutableSortedSet<E>(elementsBuilder.build(), comparator),
        cumulativeCounts,
        0,
        entries.size());
  }

Replace Generic With Diamond RegularImmutableSortedMultiset<E> with RegularImmutableSortedMultiset<> in method private copyOfSortedEntries(comparator Comparator<? super E>, entries Collection<Entry<E>>) : ImmutableSortedMultiset<E> from class dev.mccue.guava.collect.ImmutableSortedMultiset


  @SuppressWarnings("unchecked")
  static <E> ImmutableSortedMultiset<E> emptyMultiset(Comparator<? super E> comparator) {
    if (Ordering.natural().equals(comparator)) {
      return (ImmutableSortedMultiset<E>) RegularImmutableSortedMultiset.NATURAL_EMPTY_MULTISET;
    } else {
      return new RegularImmutableSortedMultiset<>(comparator);
    }
  }

  @SuppressWarnings("unchecked")
  static <E> ImmutableSortedMultiset<E> emptyMultiset(Comparator<? super E> comparator) {
    if (Ordering.natural().equals(comparator)) {
      return (ImmutableSortedMultiset<E>) RegularImmutableSortedMultiset.NATURAL_EMPTY_MULTISET;
    } else {
      return new RegularImmutableSortedMultiset<E>(comparator);
    }
  }

Replace Generic With Diamond RegularImmutableSortedMultiset<E> with RegularImmutableSortedMultiset<> in method package emptyMultiset(comparator Comparator<? super E>) : ImmutableSortedMultiset<E> from class dev.mccue.guava.collect.ImmutableSortedMultiset


  /**
   * Returns a builder that creates immutable sorted multisets with an explicit comparator. If the
   * comparator has a more general type than the set being generated, such as creating a {@code
   * SortedMultiset<Integer>} with a {@code Comparator<Number>}, use the {@code Builder} constructor
   * instead.
   *
   * @throws NullPointerException if {@code comparator} is null
   */
  public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
    return new Builder<>(comparator);
  }

  /**
   * Returns a builder that creates immutable sorted multisets with an explicit comparator. If the
   * comparator has a more general type than the set being generated, such as creating a {@code
   * SortedMultiset<Integer>} with a {@code Comparator<Number>}, use the {@code Builder} constructor
   * instead.
   *
   * @throws NullPointerException if {@code comparator} is null
   */
  public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
    return new Builder<E>(comparator);
  }

Replace Generic With Diamond Builder<E> with Builder<> in method public orderedBy(comparator Comparator<E>) : Builder<E> from class dev.mccue.guava.collect.ImmutableSortedMultiset


/**
   * Returns a builder that creates immutable sorted multisets whose elements are ordered by the
   * reverse of their natural ordering.
   *
   *
Note: the type parameter {@code E} extends {@code Comparable<?>} rather than {@code
   * Comparable<? super E>} as a workaround for javac bug 6468354.
   */
  public static <E extends Comparable<?>> Builder<E> reverseOrder() {
    return new Builder<>(Ordering.<E>natural().reverse());
  }

/**
   * Returns a builder that creates immutable sorted multisets whose elements are ordered by the
   * reverse of their natural ordering.
   *
   *
Note: the type parameter {@code E} extends {@code Comparable<?>} rather than {@code
   * Comparable<? super E>} as a workaround for javac bug 6468354.
   */
  public static <E extends Comparable<?>> Builder<E> reverseOrder() {
    return new Builder<E>(Ordering.<E>natural().reverse());
  }

Replace Generic With Diamond Builder<E> with Builder<> in method public reverseOrder() : Builder<E> from class dev.mccue.guava.collect.ImmutableSortedMultiset


/**
   * Returns a builder that creates immutable sorted multisets whose elements are ordered by their
   * natural ordering. The sorted multisets use {@code Ordering#natural()} as the comparator. This
   * method provides more type-safety than {@code #builder}, as it can be called only for classes
   * that implement {@code Comparable}.
   *
   *
Note: the type parameter {@code E} extends {@code Comparable<?>} rather than {@code
   * Comparable<? super E>} as a workaround for javac bug 6468354.
   */
  public static <E extends Comparable<?>> Builder<E> naturalOrder() {
    return new Builder<>(Ordering.natural());
  }

/**
   * Returns a builder that creates immutable sorted multisets whose elements are ordered by their
   * natural ordering. The sorted multisets use {@code Ordering#natural()} as the comparator. This
   * method provides more type-safety than {@code #builder}, as it can be called only for classes
   * that implement {@code Comparable}.
   *
   *
Note: the type parameter {@code E} extends {@code Comparable<?>} rather than {@code
   * Comparable<? super E>} as a workaround for javac bug 6468354.
   */
  public static <E extends Comparable<?>> Builder<E> naturalOrder() {
    return new Builder<E>(Ordering.natural());
  }

Replace Generic With Diamond Builder<E> with Builder<> in method public naturalOrder() : Builder<E> from class dev.mccue.guava.collect.ImmutableSortedMultiset


    /**
     * Returns a newly-created {@code ImmutableSortedSet} based on the contents of the {@code
     * Builder} and its comparator.
     */
    @Override
    public ImmutableSortedSet<E> build() {
      sortAndDedup();
      if (n == 0) {
        return emptySet(comparator);
      } else {
        forceCopy = true;
        return new RegularImmutableSortedSet<>(
            ImmutableList.asImmutableList(elements, n), comparator);
      }
    }

    /**
     * Returns a newly-created {@code ImmutableSortedSet} based on the contents of the {@code
     * Builder} and its comparator.
     */
    @Override
    public ImmutableSortedSet<E> build() {
      sortAndDedup();
      if (n == 0) {
        return emptySet(comparator);
      } else {
        forceCopy = true;
        return new RegularImmutableSortedSet<E>(
            ImmutableList.asImmutableList(elements, n), comparator);
      }
    }

Replace Generic With Diamond RegularImmutableSortedSet<E> with RegularImmutableSortedSet<> in method public build() : ImmutableSortedSet<E> from class dev.mccue.guava.collect.ImmutableSortedSet.Builder


  static <E> RegularImmutableSortedSet<E> emptySet(Comparator<? super E> comparator) {
    if (Ordering.natural().equals(comparator)) {
      @SuppressWarnings("unchecked") // The natural-ordered empty set supports all types.
      RegularImmutableSortedSet<E> result =
          (RegularImmutableSortedSet<E>) RegularImmutableSortedSet.NATURAL_EMPTY_SET;
      return result;
    } else {
      return new RegularImmutableSortedSet<>(ImmutableList.of(), comparator);
    }
  }

  static <E> RegularImmutableSortedSet<E> emptySet(Comparator<? super E> comparator) {
    if (Ordering.natural().equals(comparator)) {
      @SuppressWarnings("unchecked") // The natural-ordered empty set supports all types.
      RegularImmutableSortedSet<E> result =
          (RegularImmutableSortedSet<E>) RegularImmutableSortedSet.NATURAL_EMPTY_SET;
      return result;
    } else {
      return new RegularImmutableSortedSet<E>(ImmutableList.<E>of(), comparator);
    }
  }

Replace Generic With Diamond RegularImmutableSortedSet<E> with RegularImmutableSortedSet<> in method package emptySet(comparator Comparator<? super E>) : RegularImmutableSortedSet<E> from class dev.mccue.guava.collect.ImmutableSortedSet


  /** Returns an immutable sorted set containing a single element. */
  public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E element) {
    return new RegularImmutableSortedSet<>(ImmutableList.of(element), Ordering.natural());
  }

  /** Returns an immutable sorted set containing a single element. */
  public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E element) {
    return new RegularImmutableSortedSet<E>(ImmutableList.of(element), Ordering.natural());
  }

Replace Generic With Diamond RegularImmutableSortedSet<E> with RegularImmutableSortedSet<> in method public of(element E) : ImmutableSortedSet<E> from class dev.mccue.guava.collect.ImmutableSortedSet


/**
   * Returns an immutable sorted set containing the elements of a sorted set, sorted by the same
   * {@code Comparator}. That behavior differs from {@code #copyOf(Iterable)}, which always uses the
   * natural ordering of the elements.
   *
   *
Despite the method name, this method attempts to avoid actually copying the data when it is
   * safe to do so. The exact circumstances under which a copy will or will not be performed are
   * undocumented and subject to change.
   *
   *
This method is safe to use even when {@code sortedSet} is a synchronized or concurrent
   * collection that is currently being modified by another thread.
   *
   * @throws NullPointerException if {@code sortedSet} or any of its elements is null
   */
  public static <E> ImmutableSortedSet<E> copyOfSorted(SortedSet<E> sortedSet) {
    Comparator<? super E> comparator = SortedIterables.comparator(sortedSet);
    ImmutableList<E> list = ImmutableList.copyOf(sortedSet);
    if (list.isEmpty()) {
      return emptySet(comparator);
    } else {
      return new RegularImmutableSortedSet<>(list, comparator);
    }
  }

/**
   * Returns an immutable sorted set containing the elements of a sorted set, sorted by the same
   * {@code Comparator}. That behavior differs from {@code #copyOf(Iterable)}, which always uses the
   * natural ordering of the elements.
   *
   *
Despite the method name, this method attempts to avoid actually copying the data when it is
   * safe to do so. The exact circumstances under which a copy will or will not be performed are
   * undocumented and subject to change.
   *
   *
This method is safe to use even when {@code sortedSet} is a synchronized or concurrent
   * collection that is currently being modified by another thread.
   *
   * @throws NullPointerException if {@code sortedSet} or any of its elements is null
   */
  public static <E> ImmutableSortedSet<E> copyOfSorted(SortedSet<E> sortedSet) {
    Comparator<? super E> comparator = SortedIterables.comparator(sortedSet);
    ImmutableList<E> list = ImmutableList.copyOf(sortedSet);
    if (list.isEmpty()) {
      return emptySet(comparator);
    } else {
      return new RegularImmutableSortedSet<E>(list, comparator);
    }
  }

Replace Generic With Diamond RegularImmutableSortedSet<E> with RegularImmutableSortedSet<> in method public copyOfSorted(sortedSet SortedSet<E>) : ImmutableSortedSet<E> from class dev.mccue.guava.collect.ImmutableSortedSet


  /**
   * Constructs an {@code ImmutableSortedSet} from the first {@code n} elements of {@code contents}.
   * If {@code k} is the size of the returned {@code ImmutableSortedSet}, then the sorted unique
   * elements are in the first {@code k} positions of {@code contents}, and {@code contents[i] ==
   * null} for {@code k <= i < n}.
   *
   * <p>This method takes ownership of {@code contents}; do not modify {@code contents} after this
   * returns.
   *
   * @throws NullPointerException if any of the first {@code n} elements of {@code contents} is null
   */
  static <E> ImmutableSortedSet<E> construct(
      Comparator<? super E> comparator, int n, E... contents) {
    if (n == 0) {
      return emptySet(comparator);
    }
    checkElementsNotNull(contents, n);
    Arrays.sort(contents, 0, n, comparator);
    int uniques = 1;
    for (int i = 1; i < n; i++) {
      E cur = contents[i];
      E prev = contents[uniques - 1];
      if (comparator.compare(cur, prev) != 0) {
        contents[uniques++] = cur;
      }
    }
    Arrays.fill(contents, uniques, n, null);
    return new RegularImmutableSortedSet<>(
        ImmutableList.<E>asImmutableList(contents, uniques), comparator);
  }

  /**
   * Constructs an {@code ImmutableSortedSet} from the first {@code n} elements of {@code contents}.
   * If {@code k} is the size of the returned {@code ImmutableSortedSet}, then the sorted unique
   * elements are in the first {@code k} positions of {@code contents}, and {@code contents[i] ==
   * null} for {@code k <= i < n}.
   *
   * <p>This method takes ownership of {@code contents}; do not modify {@code contents} after this
   * returns.
   *
   * @throws NullPointerException if any of the first {@code n} elements of {@code contents} is null
   */
  static <E> ImmutableSortedSet<E> construct(
      Comparator<? super E> comparator, int n, E... contents) {
    if (n == 0) {
      return emptySet(comparator);
    }
    checkElementsNotNull(contents, n);
    Arrays.sort(contents, 0, n, comparator);
    int uniques = 1;
    for (int i = 1; i < n; i++) {
      E cur = contents[i];
      E prev = contents[uniques - 1];
      if (comparator.compare(cur, prev) != 0) {
        contents[uniques++] = cur;
      }
    }
    Arrays.fill(contents, uniques, n, null);
    return new RegularImmutableSortedSet<E>(
        ImmutableList.<E>asImmutableList(contents, uniques), comparator);
  }

Replace Generic With Diamond RegularImmutableSortedSet<E> with RegularImmutableSortedSet<> in method package construct(comparator Comparator<? super E>, n int, contents E...) : ImmutableSortedSet<E> from class dev.mccue.guava.collect.ImmutableSortedSet


  /**
   * Returns a builder that creates immutable sorted sets with an explicit comparator. If the
   * comparator has a more general type than the set being generated, such as creating a {@code
   * SortedSet<Integer>} with a {@code Comparator<Number>}, use the {@code Builder} constructor
   * instead.
   *
   * @throws NullPointerException if {@code comparator} is null
   */
  public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
    return new Builder<>(comparator);
  }

  /**
   * Returns a builder that creates immutable sorted sets with an explicit comparator. If the
   * comparator has a more general type than the set being generated, such as creating a {@code
   * SortedSet<Integer>} with a {@code Comparator<Number>}, use the {@code Builder} constructor
   * instead.
   *
   * @throws NullPointerException if {@code comparator} is null
   */
  public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
    return new Builder<E>(comparator);
  }

Replace Generic With Diamond Builder<E> with Builder<> in method public orderedBy(comparator Comparator<E>) : Builder<E> from class dev.mccue.guava.collect.ImmutableSortedSet


  /**
   * Returns a builder that creates immutable sorted sets whose elements are ordered by the reverse
   * of their natural ordering.
   */
  public static <E extends Comparable<?>> Builder<E> reverseOrder() {
    return new Builder<>(Collections.reverseOrder());
  }

  /**
   * Returns a builder that creates immutable sorted sets whose elements are ordered by the reverse
   * of their natural ordering.
   */
  public static <E extends Comparable<?>> Builder<E> reverseOrder() {
    return new Builder<E>(Collections.reverseOrder());
  }

Replace Generic With Diamond Builder<E> with Builder<> in method public reverseOrder() : Builder<E> from class dev.mccue.guava.collect.ImmutableSortedSet


  /**
   * Returns a builder that creates immutable sorted sets whose elements are ordered by their
   * natural ordering. The sorted sets use {@code Ordering#natural()} as the comparator. This method
   * provides more type-safety than {@code #builder}, as it can be called only for classes that
   * implement {@code Comparable}.
   */
  public static <E extends Comparable<?>> Builder<E> naturalOrder() {
    return new Builder<>(Ordering.natural());
  }

  /**
   * Returns a builder that creates immutable sorted sets whose elements are ordered by their
   * natural ordering. The sorted sets use {@code Ordering#natural()} as the comparator. This method
   * provides more type-safety than {@code #builder}, as it can be called only for classes that
   * implement {@code Comparable}.
   */
  public static <E extends Comparable<?>> Builder<E> naturalOrder() {
    return new Builder<E>(Ordering.natural());
  }

Replace Generic With Diamond Builder<E> with Builder<> in method public naturalOrder() : Builder<E> from class dev.mccue.guava.collect.ImmutableSortedSet


  /** Creates a new, empty {@code LinkedHashMultiset} using the default initial capacity. */
  public static <E extends @Nullable Object> LinkedHashMultiset<E> create() {
    return new LinkedHashMultiset<>();
  }

  /** Creates a new, empty {@code LinkedHashMultiset} using the default initial capacity. */
  public static <E extends @Nullable Object> LinkedHashMultiset<E> create() {
    return new LinkedHashMultiset<E>();
  }

Replace Generic With Diamond LinkedHashMultiset<E> with LinkedHashMultiset<> in method public create() : LinkedHashMultiset<E> from class dev.mccue.guava.collect.LinkedHashMultiset


  /**
   * Creates a new, empty {@code LinkedHashMultiset} with the specified expected number of distinct
   * elements.
   *
   * @param distinctElements the expected number of distinct elements
   * @throws IllegalArgumentException if {@code distinctElements} is negative
   */
  public static <E extends @Nullable Object> LinkedHashMultiset<E> create(int distinctElements) {
    return new LinkedHashMultiset<>(distinctElements);
  }

  /**
   * Creates a new, empty {@code LinkedHashMultiset} with the specified expected number of distinct
   * elements.
   *
   * @param distinctElements the expected number of distinct elements
   * @throws IllegalArgumentException if {@code distinctElements} is negative
   */
  public static <E extends @Nullable Object> LinkedHashMultiset<E> create(int distinctElements) {
    return new LinkedHashMultiset<E>(distinctElements);
  }

Replace Generic With Diamond LinkedHashMultiset<E> with LinkedHashMultiset<> in method public create(distinctElements int) : LinkedHashMultiset<E> from class dev.mccue.guava.collect.LinkedHashMultiset


      @Override
      public StrongKeyDummyValueSegment<K> newSegment(
          MapMakerInternalMap<K, Dummy, StrongKeyDummyValueEntry<K>, StrongKeyDummyValueSegment<K>>
              map,
          int initialCapacity) {
        return new StrongKeyDummyValueSegment<>(map, initialCapacity);
      }

      @Override
      public StrongKeyDummyValueSegment<K> newSegment(
          MapMakerInternalMap<K, Dummy, StrongKeyDummyValueEntry<K>, StrongKeyDummyValueSegment<K>>
              map,
          int initialCapacity) {
        return new StrongKeyDummyValueSegment<K>(map, initialCapacity);
      }

Replace Generic With Diamond StrongKeyDummyValueSegment<K> with StrongKeyDummyValueSegment<> in method public newSegment(map MapMakerInternalMap<K,Dummy,StrongKeyDummyValueEntry<K>,StrongKeyDummyValueSegment<K>>, initialCapacity int) : StrongKeyDummyValueSegment<K> from class dev.mccue.guava.collect.MapMakerInternalMap.StrongKeyDummyValueEntry.Helper


    AtomicReferenceArray<E> newEntryArray(int size) {
      return new AtomicReferenceArray<>(size);
    }

    AtomicReferenceArray<E> newEntryArray(int size) {
      return new AtomicReferenceArray<E>(size);
    }

Replace Generic With Diamond AtomicReferenceArray<E> with AtomicReferenceArray<> in method package newEntryArray(size int) : AtomicReferenceArray<E> from class dev.mccue.guava.collect.MapMakerInternalMap.Segment


    public CleanupMapTask(MapMakerInternalMap<?, ?, ?, ?> map) {
      this.mapReference = new WeakReference<>(map);
    }

    public CleanupMapTask(MapMakerInternalMap<?, ?, ?, ?> map) {
      this.mapReference = new WeakReference<MapMakerInternalMap<?, ?, ?, ?>>(map);
    }

Replace Generic With Diamond WeakReference<MapMakerInternalMap<?,?,?,?>> with WeakReference<> in method public CleanupMapTask(map MapMakerInternalMap<?,?,?,?>) from class dev.mccue.guava.collect.MapMakerInternalMap.CleanupMapTask


    static <V extends @Nullable Object> ValueDifference<V> create(
        @ParametricNullness V left, @ParametricNullness V right) {
      return new ValueDifferenceImpl<>(left, right);
    }

    static <V extends @Nullable Object> ValueDifference<V> create(
        @ParametricNullness V left, @ParametricNullness V right) {
      return new ValueDifferenceImpl<V>(left, right);
    }

Replace Generic With Diamond ValueDifferenceImpl<V> with ValueDifferenceImpl<> in method package create(left V, right V) : ValueDifference<V> from class dev.mccue.guava.collect.Maps.ValueDifferenceImpl


    @Override
    public Set<V> removeAll(@CheckForNull Object key) {
      Set<V> values = new HashSet<>(2);
      if (!map.containsKey(key)) {
        return values;
      }
      values.add(map.remove(key));
      return values;
    }

    @Override
    public Set<V> removeAll(@CheckForNull Object key) {
      Set<V> values = new HashSet<V>(2);
      if (!map.containsKey(key)) {
        return values;
      }
      values.add(map.remove(key));
      return values;
    }

Replace Generic With Diamond HashSet<V> with HashSet<> in method public removeAll(key Object) : Set<V> from class dev.mccue.guava.collect.Multimaps.MapMultimap


  /**
   * Returns an unmodifiable view of the specified multiset. Query operations on the returned
   * multiset "read through" to the specified multiset, and attempts to modify the returned multiset
   * result in an {@code UnsupportedOperationException}.
   *
   * <p>The returned multiset will be serializable if the specified multiset is serializable.
   *
   * @param multiset the multiset for which an unmodifiable view is to be generated
   * @return an unmodifiable view of the multiset
   */
  public static <E extends @Nullable Object> Multiset<E> unmodifiableMultiset(
      Multiset<? extends E> multiset) {
    if (multiset instanceof UnmodifiableMultiset || multiset instanceof ImmutableMultiset) {
      @SuppressWarnings("unchecked") // Since it's unmodifiable, the covariant cast is safe
      Multiset<E> result = (Multiset<E>) multiset;
      return result;
    }
    return new UnmodifiableMultiset<>(checkNotNull(multiset));
  }

  /**
   * Returns an unmodifiable view of the specified multiset. Query operations on the returned
   * multiset "read through" to the specified multiset, and attempts to modify the returned multiset
   * result in an {@code UnsupportedOperationException}.
   *
   * <p>The returned multiset will be serializable if the specified multiset is serializable.
   *
   * @param multiset the multiset for which an unmodifiable view is to be generated
   * @return an unmodifiable view of the multiset
   */
  public static <E extends @Nullable Object> Multiset<E> unmodifiableMultiset(
      Multiset<? extends E> multiset) {
    if (multiset instanceof UnmodifiableMultiset || multiset instanceof ImmutableMultiset) {
      @SuppressWarnings("unchecked") // Since it's unmodifiable, the covariant cast is safe
      Multiset<E> result = (Multiset<E>) multiset;
      return result;
    }
    return new UnmodifiableMultiset<E>(checkNotNull(multiset));
  }

Replace Generic With Diamond UnmodifiableMultiset<E> with UnmodifiableMultiset<> in method public unmodifiableMultiset(multiset Multiset<? extends E>) : Multiset<E> from class dev.mccue.guava.collect.Multisets


  /**
   * Returns an unmodifiable view of the specified sorted multiset. Query operations on the returned
   * multiset "read through" to the specified multiset, and attempts to modify the returned multiset
   * result in an {@code UnsupportedOperationException}.
   *
   * <p>The returned multiset will be serializable if the specified multiset is serializable.
   *
   * @param sortedMultiset the sorted multiset for which an unmodifiable view is to be generated
   * @return an unmodifiable view of the multiset
   * @since 11.0
   */
  public static <E extends @Nullable Object> SortedMultiset<E> unmodifiableSortedMultiset(
      SortedMultiset<E> sortedMultiset) {
    // it's in its own file so it can be emulated for GWT
    return new UnmodifiableSortedMultiset<>(checkNotNull(sortedMultiset));
  }

  /**
   * Returns an unmodifiable view of the specified sorted multiset. Query operations on the returned
   * multiset "read through" to the specified multiset, and attempts to modify the returned multiset
   * result in an {@code UnsupportedOperationException}.
   *
   * <p>The returned multiset will be serializable if the specified multiset is serializable.
   *
   * @param sortedMultiset the sorted multiset for which an unmodifiable view is to be generated
   * @return an unmodifiable view of the multiset
   * @since 11.0
   */
  public static <E extends @Nullable Object> SortedMultiset<E> unmodifiableSortedMultiset(
      SortedMultiset<E> sortedMultiset) {
    // it's in its own file so it can be emulated for GWT
    return new UnmodifiableSortedMultiset<E>(checkNotNull(sortedMultiset));
  }

Replace Generic With Diamond UnmodifiableSortedMultiset<E> with UnmodifiableSortedMultiset<> in method public unmodifiableSortedMultiset(sortedMultiset SortedMultiset<E>) : SortedMultiset<E> from class dev.mccue.guava.collect.Multisets


  /**
   * Returns an immutable multiset entry with the specified element and count. The entry will be
   * serializable if {@code e} is.
   *
   * @param e the element to be associated with the returned entry
   * @param n the count to be associated with the returned entry
   * @throws IllegalArgumentException if {@code n} is negative
   */
  public static <E extends @Nullable Object> Multiset.Entry<E> immutableEntry(
      @ParametricNullness E e, int n) {
    return new ImmutableEntry<>(e, n);
  }

  /**
   * Returns an immutable multiset entry with the specified element and count. The entry will be
   * serializable if {@code e} is.
   *
   * @param e the element to be associated with the returned entry
   * @param n the count to be associated with the returned entry
   * @throws IllegalArgumentException if {@code n} is negative
   */
  public static <E extends @Nullable Object> Multiset.Entry<E> immutableEntry(
      @ParametricNullness E e, int n) {
    return new ImmutableEntry<E>(e, n);
  }

Replace Generic With Diamond ImmutableEntry<E> with ImmutableEntry<> in method public immutableEntry(e E, n int) : Multiset.Entry<E> from class dev.mccue.guava.collect.Multisets


  /** An implementation of {@code Multiset#iterator}. */
  static <E extends @Nullable Object> Iterator<E> iteratorImpl(Multiset<E> multiset) {
    return new MultisetIteratorImpl<>(multiset, multiset.entrySet().iterator());
  }

  /** An implementation of {@code Multiset#iterator}. */
  static <E extends @Nullable Object> Iterator<E> iteratorImpl(Multiset<E> multiset) {
    return new MultisetIteratorImpl<E>(multiset, multiset.entrySet().iterator());
  }

Replace Generic With Diamond MultisetIteratorImpl<E> with MultisetIteratorImpl<> in method package iteratorImpl(multiset Multiset<E>) : Iterator<E> from class dev.mccue.guava.collect.Multisets


  /**
   * Returns a new {@code MutableClassToInstanceMap} instance backed by a {@code HashMap} using the
   * default initial capacity and load factor.
   */
  public static <B extends @Nullable Object> MutableClassToInstanceMap<B> create() {
    return new MutableClassToInstanceMap<>(new HashMap<Class<? extends @NonNull B>, B>());
  }

  /**
   * Returns a new {@code MutableClassToInstanceMap} instance backed by a {@code HashMap} using the
   * default initial capacity and load factor.
   */
  public static <B extends @Nullable Object> MutableClassToInstanceMap<B> create() {
    return new MutableClassToInstanceMap<B>(new HashMap<Class<? extends @NonNull B>, B>());
  }

Replace Generic With Diamond MutableClassToInstanceMap<B> with MutableClassToInstanceMap<> in method public create() : MutableClassToInstanceMap<B> from class dev.mccue.guava.collect.MutableClassToInstanceMap


  /**
   * Returns a new {@code MutableClassToInstanceMap} instance backed by a given empty {@code
   * backingMap}. The caller surrenders control of the backing map, and thus should not allow any
   * direct references to it to remain accessible.
   */
  public static <B extends @Nullable Object> MutableClassToInstanceMap<B> create(
      Map<Class<? extends @NonNull B>, B> backingMap) {
    return new MutableClassToInstanceMap<>(backingMap);
  }

  /**
   * Returns a new {@code MutableClassToInstanceMap} instance backed by a given empty {@code
   * backingMap}. The caller surrenders control of the backing map, and thus should not allow any
   * direct references to it to remain accessible.
   */
  public static <B extends @Nullable Object> MutableClassToInstanceMap<B> create(
      Map<Class<? extends @NonNull B>, B> backingMap) {
    return new MutableClassToInstanceMap<B>(backingMap);
  }

Replace Generic With Diamond MutableClassToInstanceMap<B> with MutableClassToInstanceMap<> in method public create(backingMap Map<Class<? extends @NonNull B>,B>) : MutableClassToInstanceMap<B> from class dev.mccue.guava.collect.MutableClassToInstanceMap


/**
   * Returns an ordering that compares objects according to the order in which they appear in the
   * given list. Only objects present in the list (according to {@code Object#equals}) may be
   * compared. This comparator imposes a "partial ordering" over the type {@code T}. Subsequent
   * changes to the {@code valuesInOrder} list will have no effect on the returned comparator. Null
   * values in the list are not supported.
   *
   *
The returned comparator throws a {@code ClassCastException} when it receives an input
   * parameter that isn't among the provided values.
   *
   *
The generated comparator is serializable if all the provided values are serializable.
   *
   * @param valuesInOrder the values that the returned comparator will be able to compare, in the
   *     order the comparator should induce
   * @return the comparator described above
   * @throws NullPointerException if any of the provided values is null
   * @throws IllegalArgumentException if {@code valuesInOrder} contains any duplicate values
   *     (according to {@code Object#equals})
   */
  // TODO(kevinb): provide replacement

  public static <T> Ordering<T> explicit(List<T> valuesInOrder) {
    return new ExplicitOrdering<>(valuesInOrder);
  }

/**
   * Returns an ordering that compares objects according to the order in which they appear in the
   * given list. Only objects present in the list (according to {@code Object#equals}) may be
   * compared. This comparator imposes a "partial ordering" over the type {@code T}. Subsequent
   * changes to the {@code valuesInOrder} list will have no effect on the returned comparator. Null
   * values in the list are not supported.
   *
   *
The returned comparator throws a {@code ClassCastException} when it receives an input
   * parameter that isn't among the provided values.
   *
   *
The generated comparator is serializable if all the provided values are serializable.
   *
   * @param valuesInOrder the values that the returned comparator will be able to compare, in the
   *     order the comparator should induce
   * @return the comparator described above
   * @throws NullPointerException if any of the provided values is null
   * @throws IllegalArgumentException if {@code valuesInOrder} contains any duplicate values
   *     (according to {@code Object#equals})
   */
  // TODO(kevinb): provide replacement

  public static <T> Ordering<T> explicit(List<T> valuesInOrder) {
    return new ExplicitOrdering<T>(valuesInOrder);
  }

Replace Generic With Diamond ExplicitOrdering<T> with ExplicitOrdering<> in method public explicit(valuesInOrder List<T>) : Ordering<T> from class dev.mccue.guava.collect.Ordering


/**
   * Returns the reverse of this ordering; the {@code Ordering} equivalent to {@code
   * Collections#reverseOrder(Comparator)}.
   *
   *
Java 8+ users: Use {@code thisComparator.reversed()} instead.
   */
  // type parameter <S> lets us avoid the extra <String> in statements like:
  // Ordering<String> o = Ordering.<String>natural().reverse();

  public <S extends T> Ordering<S> reverse() {
    return new ReverseOrdering<>(this);
  }

/**
   * Returns the reverse of this ordering; the {@code Ordering} equivalent to {@code
   * Collections#reverseOrder(Comparator)}.
   *
   *
Java 8+ users: Use {@code thisComparator.reversed()} instead.
   */
  // type parameter <S> lets us avoid the extra <String> in statements like:
  // Ordering<String> o = Ordering.<String>natural().reverse();

  public <S extends T> Ordering<S> reverse() {
    return new ReverseOrdering<S>(this);
  }

Replace Generic With Diamond ReverseOrdering<S> with ReverseOrdering<> in method public reverse() : Ordering<S> from class dev.mccue.guava.collect.Ordering


/**
   * Returns an ordering which first uses the ordering {@code this}, but which in the event of a
   * "tie", then delegates to {@code secondaryComparator}. For example, to sort a bug list first by
   * status and second by priority, you might use {@code byStatus.compound(byPriority)}. For a
   * compound ordering with three or more components, simply chain multiple calls to this method.
   *
   *
An ordering produced by this method, or a chain of calls to this method, is equivalent to
   * one created using {@code Ordering#compound(Iterable)} on the same component comparators.
   *
   *
The returned object is serializable if this object and {@code secondaryComparator} are both
   * serializable.
   *
   *
Java 8+ users: Use {@code thisComparator.thenComparing(secondaryComparator)} instead.
   * Depending on what {@code secondaryComparator} is, one of the other overloads of {@code
   * thenComparing} may be even more useful.
   */

  public  Ordering compound(Comparator<? super U> secondaryComparator) {
    return new CompoundOrdering<>(this, checkNotNull(secondaryComparator));
  }

/**
   * Returns an ordering which first uses the ordering {@code this}, but which in the event of a
   * "tie", then delegates to {@code secondaryComparator}. For example, to sort a bug list first by
   * status and second by priority, you might use {@code byStatus.compound(byPriority)}. For a
   * compound ordering with three or more components, simply chain multiple calls to this method.
   *
   *
An ordering produced by this method, or a chain of calls to this method, is equivalent to
   * one created using {@code Ordering#compound(Iterable)} on the same component comparators.
   *
   *
The returned object is serializable if this object and {@code secondaryComparator} are both
   * serializable.
   *
   *
Java 8+ users: Use {@code thisComparator.thenComparing(secondaryComparator)} instead.
   * Depending on what {@code secondaryComparator} is, one of the other overloads of {@code
   * thenComparing} may be even more useful.
   */

  public  Ordering compound(Comparator<? super U> secondaryComparator) {
    return new CompoundOrdering(this, checkNotNull(secondaryComparator));
  }

Replace Generic With Diamond CompoundOrdering<U> with CompoundOrdering<> in method public compound(secondaryComparator Comparator<? super U>) : Ordering<U> from class dev.mccue.guava.collect.Ordering


/**
   * Returns an ordering which tries each given comparator in order until a non-zero result is
   * found, returning that result, and returning zero only if all comparators return zero. The
   * returned ordering is based on the state of the {@code comparators} iterable at the time it was
   * provided to this method.
   *
   *
The returned ordering is equivalent to that produced using {@code
   * Ordering.from(comp1).compound(comp2).compound(comp3) . . .}.
   *
   *
The returned object is serializable if each of the {@code comparators} is serializable.
   *
   *
Warning: Supplying an argument with undefined iteration order, such as a {@code
   * HashSet}, will produce non-deterministic results.
   *
   *
Java 8+ users: Use a chain of calls to {@code Comparator#thenComparing(Comparator)},
   * or {@code comparatorCollection.stream().reduce(Comparator::thenComparing).get()} (if the
   * collection might be empty, also provide a default comparator as the {@code identity} parameter
   * to {@code reduce}).
   *
   * @param comparators the comparators to try in order
   */

  public static <T extends @Nullable Object> Ordering<T> compound(
      Iterable<? extends Comparator<? super T>> comparators) {
    return new CompoundOrdering<>(comparators);
  }

/**
   * Returns an ordering which tries each given comparator in order until a non-zero result is
   * found, returning that result, and returning zero only if all comparators return zero. The
   * returned ordering is based on the state of the {@code comparators} iterable at the time it was
   * provided to this method.
   *
   *
The returned ordering is equivalent to that produced using {@code
   * Ordering.from(comp1).compound(comp2).compound(comp3) . . .}.
   *
   *
The returned object is serializable if each of the {@code comparators} is serializable.
   *
   *
Warning: Supplying an argument with undefined iteration order, such as a {@code
   * HashSet}, will produce non-deterministic results.
   *
   *
Java 8+ users: Use a chain of calls to {@code Comparator#thenComparing(Comparator)},
   * or {@code comparatorCollection.stream().reduce(Comparator::thenComparing).get()} (if the
   * collection might be empty, also provide a default comparator as the {@code identity} parameter
   * to {@code reduce}).
   *
   * @param comparators the comparators to try in order
   */

  public static <T extends @Nullable Object> Ordering<T> compound(
      Iterable<? extends Comparator<? super T>> comparators) {
    return new CompoundOrdering<T>(comparators);
  }

Replace Generic With Diamond CompoundOrdering<T> with CompoundOrdering<> in method public compound(comparators Iterable<? extends Comparator<? super T>>) : Ordering<T> from class dev.mccue.guava.collect.Ordering


  /**
   * Creates an empty {@code ArrayBlockingQueue} with the given (fixed) capacity and nonfair access
   * policy.
   */
  // ArrayBlockingQueue
  public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(int capacity) {
    return new ArrayBlockingQueue<>(capacity);
  }

  /**
   * Creates an empty {@code ArrayBlockingQueue} with the given (fixed) capacity and nonfair access
   * policy.
   */
  // ArrayBlockingQueue
  public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(int capacity) {
    return new ArrayBlockingQueue<E>(capacity);
  }

Replace Generic With Diamond ArrayBlockingQueue<E> with ArrayBlockingQueue<> in method public newArrayBlockingQueue(capacity int) : ArrayBlockingQueue<E> from class dev.mccue.guava.collect.Queues


  /**
   * Creates an empty {@code ArrayDeque}.
   *
   * @since 12.0
   */
  public static <E> ArrayDeque<E> newArrayDeque() {
    return new ArrayDeque<>();
  }

  /**
   * Creates an empty {@code ArrayDeque}.
   *
   * @since 12.0
   */
  public static <E> ArrayDeque<E> newArrayDeque() {
    return new ArrayDeque<E>();
  }

Replace Generic With Diamond ArrayDeque<E> with ArrayDeque<> in method public newArrayDeque() : ArrayDeque<E> from class dev.mccue.guava.collect.Queues


  /** Creates an empty {@code ConcurrentLinkedQueue}. */
  // ConcurrentLinkedQueue
  public static <E> ConcurrentLinkedQueue<E> newConcurrentLinkedQueue() {
    return new ConcurrentLinkedQueue<>();
  }

  /** Creates an empty {@code ConcurrentLinkedQueue}. */
  // ConcurrentLinkedQueue
  public static <E> ConcurrentLinkedQueue<E> newConcurrentLinkedQueue() {
    return new ConcurrentLinkedQueue<E>();
  }

Replace Generic With Diamond ConcurrentLinkedQueue<E> with ConcurrentLinkedQueue<> in method public newConcurrentLinkedQueue() : ConcurrentLinkedQueue<E> from class dev.mccue.guava.collect.Queues


  /**
   * Creates an empty {@code LinkedBlockingDeque} with a capacity of {@code Integer#MAX_VALUE}.
   *
   * @since 12.0
   */
  // LinkedBlockingDeque
  public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque() {
    return new LinkedBlockingDeque<>();
  }

  /**
   * Creates an empty {@code LinkedBlockingDeque} with a capacity of {@code Integer#MAX_VALUE}.
   *
   * @since 12.0
   */
  // LinkedBlockingDeque
  public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque() {
    return new LinkedBlockingDeque<E>();
  }

Replace Generic With Diamond LinkedBlockingDeque<E> with LinkedBlockingDeque<> in method public newLinkedBlockingDeque() : LinkedBlockingDeque<E> from class dev.mccue.guava.collect.Queues


  /**
   * Creates an empty {@code LinkedBlockingDeque} with the given (fixed) capacity.
   *
   * @throws IllegalArgumentException if {@code capacity} is less than 1
   * @since 12.0
   */
  // LinkedBlockingDeque
  public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque(int capacity) {
    return new LinkedBlockingDeque<>(capacity);
  }

  /**
   * Creates an empty {@code LinkedBlockingDeque} with the given (fixed) capacity.
   *
   * @throws IllegalArgumentException if {@code capacity} is less than 1
   * @since 12.0
   */
  // LinkedBlockingDeque
  public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque(int capacity) {
    return new LinkedBlockingDeque<E>(capacity);
  }

Replace Generic With Diamond LinkedBlockingDeque<E> with LinkedBlockingDeque<> in method public newLinkedBlockingDeque(capacity int) : LinkedBlockingDeque<E> from class dev.mccue.guava.collect.Queues


  /** Creates an empty {@code LinkedBlockingQueue} with a capacity of {@code Integer#MAX_VALUE}. */
  // LinkedBlockingQueue
  public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue() {
    return new LinkedBlockingQueue<>();
  }

  /** Creates an empty {@code LinkedBlockingQueue} with a capacity of {@code Integer#MAX_VALUE}. */
  // LinkedBlockingQueue
  public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue() {
    return new LinkedBlockingQueue<E>();
  }

Replace Generic With Diamond LinkedBlockingQueue<E> with LinkedBlockingQueue<> in method public newLinkedBlockingQueue() : LinkedBlockingQueue<E> from class dev.mccue.guava.collect.Queues


  /**
   * Creates an empty {@code LinkedBlockingQueue} with the given (fixed) capacity.
   *
   * @throws IllegalArgumentException if {@code capacity} is less than 1
   */
  // LinkedBlockingQueue
  public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(int capacity) {
    return new LinkedBlockingQueue<>(capacity);
  }

  /**
   * Creates an empty {@code LinkedBlockingQueue} with the given (fixed) capacity.
   *
   * @throws IllegalArgumentException if {@code capacity} is less than 1
   */
  // LinkedBlockingQueue
  public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(int capacity) {
    return new LinkedBlockingQueue<E>(capacity);
  }

Replace Generic With Diamond LinkedBlockingQueue<E> with LinkedBlockingQueue<> in method public newLinkedBlockingQueue(capacity int) : LinkedBlockingQueue<E> from class dev.mccue.guava.collect.Queues


  /**
   * Creates an empty {@code PriorityBlockingQueue} with the ordering given by its elements' natural
   * ordering.
   *
   * @since 11.0 (but the bound of {@code E} was changed from {@code Object} to {@code Comparable}
   *     in 15.0)
   */
  @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
  // PriorityBlockingQueue
  public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue() {
    return new PriorityBlockingQueue<>();
  }

  /**
   * Creates an empty {@code PriorityBlockingQueue} with the ordering given by its elements' natural
   * ordering.
   *
   * @since 11.0 (but the bound of {@code E} was changed from {@code Object} to {@code Comparable}
   *     in 15.0)
   */
  @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
  // PriorityBlockingQueue
  public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue() {
    return new PriorityBlockingQueue<E>();
  }

Replace Generic With Diamond PriorityBlockingQueue<E> with PriorityBlockingQueue<> in method public newPriorityBlockingQueue() : PriorityBlockingQueue<E> from class dev.mccue.guava.collect.Queues


  /**
   * Creates an empty {@code PriorityQueue} with the ordering given by its elements' natural
   * ordering.
   *
   * @since 11.0 (but the bound of {@code E} was changed from {@code Object} to {@code Comparable}
   *     in 15.0)
   */
  @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
  public static <E extends Comparable> PriorityQueue<E> newPriorityQueue() {
    return new PriorityQueue<>();
  }

  /**
   * Creates an empty {@code PriorityQueue} with the ordering given by its elements' natural
   * ordering.
   *
   * @since 11.0 (but the bound of {@code E} was changed from {@code Object} to {@code Comparable}
   *     in 15.0)
   */
  @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
  public static <E extends Comparable> PriorityQueue<E> newPriorityQueue() {
    return new PriorityQueue<E>();
  }

Replace Generic With Diamond PriorityQueue<E> with PriorityQueue<> in method public newPriorityQueue() : PriorityQueue<E> from class dev.mccue.guava.collect.Queues


  /** Creates an empty {@code SynchronousQueue} with nonfair access policy. */
  // SynchronousQueue
  public static <E> SynchronousQueue<E> newSynchronousQueue() {
    return new SynchronousQueue<>();
  }

  /** Creates an empty {@code SynchronousQueue} with nonfair access policy. */
  // SynchronousQueue
  public static <E> SynchronousQueue<E> newSynchronousQueue() {
    return new SynchronousQueue<E>();
  }

Replace Generic With Diamond SynchronousQueue<E> with SynchronousQueue<> in method public newSynchronousQueue() : SynchronousQueue<E> from class dev.mccue.guava.collect.Queues


  static <E> ImmutableMultiset<E> create(Collection<? extends Entry<? extends E>> entries) {
    int distinct = entries.size();
    @SuppressWarnings({"unchecked", "rawtypes"})
    ImmutableEntry<E>[] entryArray = new ImmutableEntry[distinct];
    if (distinct == 0) {
      return new RegularImmutableMultiset<>(entryArray, EMPTY_ARRAY, 0, 0, ImmutableSet.of());
    }
    int tableSize = Hashing.closedTableSize(distinct, MAX_LOAD_FACTOR);
    int mask = tableSize - 1;
    @SuppressWarnings({"unchecked", "rawtypes"})
    @Nullable
    ImmutableEntry<E>[] hashTable = new @Nullable ImmutableEntry[tableSize];

    int index = 0;
    int hashCode = 0;
    long size = 0;
    for (Entry<? extends E> entryWithWildcard : entries) {
      @SuppressWarnings("unchecked") // safe because we only read from it
      Entry<E> entry = (Entry<E>) entryWithWildcard;
      E element = checkNotNull(entry.getElement());
      int count = entry.getCount();
      int hash = element.hashCode();
      int bucket = Hashing.smear(hash) & mask;
      ImmutableEntry<E> bucketHead = hashTable[bucket];
      ImmutableEntry<E> newEntry;
      if (bucketHead == null) {
        boolean canReuseEntry =
            entry instanceof ImmutableEntry && !(entry instanceof NonTerminalEntry);
        newEntry =
            canReuseEntry ? (ImmutableEntry<E>) entry : new ImmutableEntry<E>(element, count);
      } else {
        newEntry = new NonTerminalEntry<>(element, count, bucketHead);
      }
      hashCode += hash ^ count;
      entryArray[index++] = newEntry;
      hashTable[bucket] = newEntry;
      size += count;
    }

    return hashFloodingDetected(hashTable)
        ? JdkBackedImmutableMultiset.create(ImmutableList.asImmutableList(entryArray))
        : new RegularImmutableMultiset<E>(
            entryArray, hashTable, Ints.saturatedCast(size), hashCode, null);
  }

  static <E> ImmutableMultiset<E> create(Collection<? extends Entry<? extends E>> entries) {
    int distinct = entries.size();
    @SuppressWarnings({"unchecked", "rawtypes"})
    ImmutableEntry<E>[] entryArray = new ImmutableEntry[distinct];
    if (distinct == 0) {
      return new RegularImmutableMultiset<>(entryArray, EMPTY_ARRAY, 0, 0, ImmutableSet.of());
    }
    int tableSize = Hashing.closedTableSize(distinct, MAX_LOAD_FACTOR);
    int mask = tableSize - 1;
    @SuppressWarnings({"unchecked", "rawtypes"})
    @Nullable
    ImmutableEntry<E>[] hashTable = new @Nullable ImmutableEntry[tableSize];

    int index = 0;
    int hashCode = 0;
    long size = 0;
    for (Entry<? extends E> entryWithWildcard : entries) {
      @SuppressWarnings("unchecked") // safe because we only read from it
      Entry<E> entry = (Entry<E>) entryWithWildcard;
      E element = checkNotNull(entry.getElement());
      int count = entry.getCount();
      int hash = element.hashCode();
      int bucket = Hashing.smear(hash) & mask;
      ImmutableEntry<E> bucketHead = hashTable[bucket];
      ImmutableEntry<E> newEntry;
      if (bucketHead == null) {
        boolean canReuseEntry =
            entry instanceof ImmutableEntry && !(entry instanceof NonTerminalEntry);
        newEntry =
            canReuseEntry ? (ImmutableEntry<E>) entry : new ImmutableEntry<E>(element, count);
      } else {
        newEntry = new NonTerminalEntry<E>(element, count, bucketHead);
      }
      hashCode += hash ^ count;
      entryArray[index++] = newEntry;
      hashTable[bucket] = newEntry;
      size += count;
    }

    return hashFloodingDetected(hashTable)
        ? JdkBackedImmutableMultiset.create(ImmutableList.asImmutableList(entryArray))
        : new RegularImmutableMultiset<E>(
            entryArray, hashTable, Ints.saturatedCast(size), hashCode, null);
  }

Replace Generic With Diamond NonTerminalEntry<E> with NonTerminalEntry<> in method package create(entries Collection<? extends Entry<? extends E>>) : ImmutableMultiset<E> from class dev.mccue.guava.collect.RegularImmutableMultiset


  ImmutableSortedMultiset<E> getSubMultiset(int from, int to) {
    checkPositionIndexes(from, to, length);
    if (from == to) {
      return emptyMultiset(comparator());
    } else if (from == 0 && to == length) {
      return this;
    } else {
      RegularImmutableSortedSet<E> subElementSet = elementSet.getSubSet(from, to);
      return new RegularImmutableSortedMultiset<>(
          subElementSet, cumulativeCounts, offset + from, to - from);
    }
  }

  ImmutableSortedMultiset<E> getSubMultiset(int from, int to) {
    checkPositionIndexes(from, to, length);
    if (from == to) {
      return emptyMultiset(comparator());
    } else if (from == 0 && to == length) {
      return this;
    } else {
      RegularImmutableSortedSet<E> subElementSet = elementSet.getSubSet(from, to);
      return new RegularImmutableSortedMultiset<E>(
          subElementSet, cumulativeCounts, offset + from, to - from);
    }
  }

Replace Generic With Diamond RegularImmutableSortedMultiset<E> with RegularImmutableSortedMultiset<> in method package getSubMultiset(from int, to int) : ImmutableSortedMultiset<E> from class dev.mccue.guava.collect.RegularImmutableSortedMultiset


  RegularImmutableSortedSet<E> getSubSet(int newFromIndex, int newToIndex) {
    if (newFromIndex == 0 && newToIndex == size()) {
      return this;
    } else if (newFromIndex < newToIndex) {
      return new RegularImmutableSortedSet<>(
          elements.subList(newFromIndex, newToIndex), comparator);
    } else {
      return emptySet(comparator);
    }
  }

  RegularImmutableSortedSet<E> getSubSet(int newFromIndex, int newToIndex) {
    if (newFromIndex == 0 && newToIndex == size()) {
      return this;
    } else if (newFromIndex < newToIndex) {
      return new RegularImmutableSortedSet<E>(
          elements.subList(newFromIndex, newToIndex), comparator);
    } else {
      return emptySet(comparator);
    }
  }

Replace Generic With Diamond RegularImmutableSortedSet<E> with RegularImmutableSortedSet<> in method package getSubSet(newFromIndex int, newToIndex int) : RegularImmutableSortedSet<E> from class dev.mccue.guava.collect.RegularImmutableSortedSet


    @Override
    public SortedSet<E> subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) {
      return new FilteredSortedSet<>(
          ((SortedSet<E>) unfiltered).subSet(fromElement, toElement), predicate);
    }

    @Override
    public SortedSet<E> subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) {
      return new FilteredSortedSet<E>(
          ((SortedSet<E>) unfiltered).subSet(fromElement, toElement), predicate);
    }

Replace Generic With Diamond FilteredSortedSet<E> with FilteredSortedSet<> in method public subSet(fromElement E, toElement E) : SortedSet<E> from class dev.mccue.guava.collect.Sets.FilteredSortedSet


    @Override
    public SortedSet<E> headSet(@ParametricNullness E toElement) {
      return new FilteredSortedSet<>(((SortedSet<E>) unfiltered).headSet(toElement), predicate);
    }

    @Override
    public SortedSet<E> headSet(@ParametricNullness E toElement) {
      return new FilteredSortedSet<E>(((SortedSet<E>) unfiltered).headSet(toElement), predicate);
    }

Replace Generic With Diamond FilteredSortedSet<E> with FilteredSortedSet<> in method public headSet(toElement E) : SortedSet<E> from class dev.mccue.guava.collect.Sets.FilteredSortedSet


    @Override
    public SortedSet<E> tailSet(@ParametricNullness E fromElement) {
      return new FilteredSortedSet<>(((SortedSet<E>) unfiltered).tailSet(fromElement), predicate);
    }

    @Override
    public SortedSet<E> tailSet(@ParametricNullness E fromElement) {
      return new FilteredSortedSet<E>(((SortedSet<E>) unfiltered).tailSet(fromElement), predicate);
    }

Replace Generic With Diamond FilteredSortedSet<E> with FilteredSortedSet<> in method public tailSet(fromElement E) : SortedSet<E> from class dev.mccue.guava.collect.Sets.FilteredSortedSet


        @Override
        protected Set<E> get(final int setBits) {
          return new SubSet<>(inputSet, setBits);
        }

        @Override
        protected Set<E> get(final int setBits) {
          return new SubSet<E>(inputSet, setBits);
        }

Replace Generic With Diamond SubSet<E> with SubSet<> in method protected get(setBits int) : Set<E> from class dev.mccue.guava.collect.Sets.PowerSet.iterator.new AbstractIndexedListIterator<Set<E>>


    @Override
    public Iterator<Set<E>> iterator() {
      return new AbstractIndexedListIterator<Set<E>>(size()) {
        @Override
        protected Set<E> get(final int setBits) {
          return new SubSet<>(inputSet, setBits);
        }
      };
    }

    @Override
    public Iterator<Set<E>> iterator() {
      return new AbstractIndexedListIterator<Set<E>>(size()) {
        @Override
        protected Set<E> get(final int setBits) {
          return new SubSet<E>(inputSet, setBits);
        }
      };
    }

Replace Generic With Diamond SubSet<E> with SubSet<> in method public iterator() : Iterator<Set<E>> from class dev.mccue.guava.collect.Sets.PowerSet


    @Override
    public NavigableSet<E> descendingSet() {
      UnmodifiableNavigableSet<E> result = descendingSet;
      if (result == null) {
        result = descendingSet = new UnmodifiableNavigableSet<>(delegate.descendingSet());
        result.descendingSet = this;
      }
      return result;
    }

    @Override
    public NavigableSet<E> descendingSet() {
      UnmodifiableNavigableSet<E> result = descendingSet;
      if (result == null) {
        result = descendingSet = new UnmodifiableNavigableSet<E>(delegate.descendingSet());
        result.descendingSet = this;
      }
      return result;
    }

Replace Generic With Diamond UnmodifiableNavigableSet<E> with UnmodifiableNavigableSet<> in method public descendingSet() : NavigableSet<E> from class dev.mccue.guava.collect.Sets.UnmodifiableNavigableSet


/**
   * Creates a mutable, initially empty {@code HashSet} instance.
   *
   *
Note: if mutability is not required, use {@code ImmutableSet#of()} instead. If {@code
   * E} is an {@code Enum} type, use {@code EnumSet#noneOf} instead. Otherwise, strongly consider
   * using a {@code LinkedHashSet} instead, at the cost of increased memory footprint, to get
   * deterministic iteration behavior.
   *
   *
Note: this method is now unnecessary and should be treated as deprecated. Instead,
   * use the {@code HashSet} constructor directly, taking advantage of "diamond" syntax.
   */
  public static <E extends @Nullable Object> HashSet<E> newHashSet() {
    return new HashSet<>();
  }

/**
   * Creates a mutable, initially empty {@code HashSet} instance.
   *
   *
Note: if mutability is not required, use {@code ImmutableSet#of()} instead. If {@code
   * E} is an {@code Enum} type, use {@code EnumSet#noneOf} instead. Otherwise, strongly consider
   * using a {@code LinkedHashSet} instead, at the cost of increased memory footprint, to get
   * deterministic iteration behavior.
   *
   *
Note: this method is now unnecessary and should be treated as deprecated. Instead,
   * use the {@code HashSet} constructor directly, taking advantage of "diamond" syntax.
   */
  public static <E extends @Nullable Object> HashSet<E> newHashSet() {
    return new HashSet<E>();
  }

Replace Generic With Diamond HashSet<E> with HashSet<> in method public newHashSet() : HashSet<E> from class dev.mccue.guava.collect.Sets


  /**
   * Returns a new hash set using the smallest initial table size that can hold {@code expectedSize}
   * elements without resizing. Note that this is not what {@code HashSet#HashSet(int)} does, but it
   * is what most users want and expect it to do.
   *
   * <p>This behavior can't be broadly guaranteed, but has been tested with OpenJDK 1.7 and 1.8.
   *
   * @param expectedSize the number of elements you expect to add to the returned set
   * @return a new, empty hash set with enough capacity to hold {@code expectedSize} elements
   *     without resizing
   * @throws IllegalArgumentException if {@code expectedSize} is negative
   */
  public static <E extends @Nullable Object> HashSet<E> newHashSetWithExpectedSize(
      int expectedSize) {
    return new HashSet<>(Maps.capacity(expectedSize));
  }

  /**
   * Returns a new hash set using the smallest initial table size that can hold {@code expectedSize}
   * elements without resizing. Note that this is not what {@code HashSet#HashSet(int)} does, but it
   * is what most users want and expect it to do.
   *
   * <p>This behavior can't be broadly guaranteed, but has been tested with OpenJDK 1.7 and 1.8.
   *
   * @param expectedSize the number of elements you expect to add to the returned set
   * @return a new, empty hash set with enough capacity to hold {@code expectedSize} elements
   *     without resizing
   * @throws IllegalArgumentException if {@code expectedSize} is negative
   */
  public static <E extends @Nullable Object> HashSet<E> newHashSetWithExpectedSize(
      int expectedSize) {
    return new HashSet<E>(Maps.capacity(expectedSize));
  }

Replace Generic With Diamond HashSet<E> with HashSet<> in method public newHashSetWithExpectedSize(expectedSize int) : HashSet<E> from class dev.mccue.guava.collect.Sets


/**
   * Creates a mutable, empty {@code LinkedHashSet} instance.
   *
   *
Note: if mutability is not required, use {@code ImmutableSet#of()} instead.
   *
   *
Note: this method is now unnecessary and should be treated as deprecated. Instead,
   * use the {@code LinkedHashSet} constructor directly, taking advantage of "diamond" syntax.
   *
   * @return a new, empty {@code LinkedHashSet}
   */
  public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSet() {
    return new LinkedHashSet<>();
  }

/**
   * Creates a mutable, empty {@code LinkedHashSet} instance.
   *
   *
Note: if mutability is not required, use {@code ImmutableSet#of()} instead.
   *
   *
Note: this method is now unnecessary and should be treated as deprecated. Instead,
   * use the {@code LinkedHashSet} constructor directly, taking advantage of "diamond" syntax.
   *
   * @return a new, empty {@code LinkedHashSet}
   */
  public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSet() {
    return new LinkedHashSet<E>();
  }

Replace Generic With Diamond LinkedHashSet<E> with LinkedHashSet<> in method public newLinkedHashSet() : LinkedHashSet<E> from class dev.mccue.guava.collect.Sets


/**
   * Creates a mutable {@code LinkedHashSet} instance containing the given elements in order.
   *
   *
Note: if mutability is not required and the elements are non-null, use {@code
   * ImmutableSet#copyOf(Iterable)} instead.
   *
   *
Note: if {@code elements} is a {@code Collection}, you don't need this method.
   * Instead, use the {@code LinkedHashSet} constructor directly, taking advantage of "diamond" syntax.
   *
   *
Overall, this method is not very useful and will likely be deprecated in the future.
   *
   * @param elements the elements that the set should contain, in order
   * @return a new {@code LinkedHashSet} containing those elements (minus duplicates)
   */
  public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSet(
      Iterable<? extends E> elements) {
    if (elements instanceof Collection) {
      return new LinkedHashSet<>((Collection<? extends E>) elements);
    }
    LinkedHashSet<E> set = newLinkedHashSet();
    Iterables.addAll(set, elements);
    return set;
  }

/**
   * Creates a mutable {@code LinkedHashSet} instance containing the given elements in order.
   *
   *
Note: if mutability is not required and the elements are non-null, use {@code
   * ImmutableSet#copyOf(Iterable)} instead.
   *
   *
Note: if {@code elements} is a {@code Collection}, you don't need this method.
   * Instead, use the {@code LinkedHashSet} constructor directly, taking advantage of "diamond" syntax.
   *
   *
Overall, this method is not very useful and will likely be deprecated in the future.
   *
   * @param elements the elements that the set should contain, in order
   * @return a new {@code LinkedHashSet} containing those elements (minus duplicates)
   */
  public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSet(
      Iterable<? extends E> elements) {
    if (elements instanceof Collection) {
      return new LinkedHashSet<E>((Collection<? extends E>) elements);
    }
    LinkedHashSet<E> set = newLinkedHashSet();
    Iterables.addAll(set, elements);
    return set;
  }

Replace Generic With Diamond LinkedHashSet<E> with LinkedHashSet<> in method public newLinkedHashSet(elements Iterable<? extends E>) : LinkedHashSet<E> from class dev.mccue.guava.collect.Sets


/**
   * Creates a {@code LinkedHashSet} instance, with a high enough "initial capacity" that it
   * should hold {@code expectedSize} elements without growth. This behavior cannot be
   * broadly guaranteed, but it is observed to be true for OpenJDK 1.7. It also can't be guaranteed
   * that the method isn't inadvertently oversizing the returned set.
   *
   * @param expectedSize the number of elements you expect to add to the returned set
   * @return a new, empty {@code LinkedHashSet} with enough capacity to hold {@code expectedSize}
   *     elements without resizing
   * @throws IllegalArgumentException if {@code expectedSize} is negative
   * @since 11.0
   */
  public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSetWithExpectedSize(
      int expectedSize) {
    return new LinkedHashSet<>(Maps.capacity(expectedSize));
  }

/**
   * Creates a {@code LinkedHashSet} instance, with a high enough "initial capacity" that it
   * should hold {@code expectedSize} elements without growth. This behavior cannot be
   * broadly guaranteed, but it is observed to be true for OpenJDK 1.7. It also can't be guaranteed
   * that the method isn't inadvertently oversizing the returned set.
   *
   * @param expectedSize the number of elements you expect to add to the returned set
   * @return a new, empty {@code LinkedHashSet} with enough capacity to hold {@code expectedSize}
   *     elements without resizing
   * @throws IllegalArgumentException if {@code expectedSize} is negative
   * @since 11.0
   */
  public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSetWithExpectedSize(
      int expectedSize) {
    return new LinkedHashSet<E>(Maps.capacity(expectedSize));
  }

Replace Generic With Diamond LinkedHashSet<E> with LinkedHashSet<> in method public newLinkedHashSetWithExpectedSize(expectedSize int) : LinkedHashSet<E> from class dev.mccue.guava.collect.Sets


/**
   * Creates a mutable, empty {@code TreeSet} instance sorted by the natural sort ordering of
   * its elements.
   *
   *
Note: if mutability is not required, use {@code ImmutableSortedSet#of()} instead.
   *
   *
Note: this method is now unnecessary and should be treated as deprecated. Instead,
   * use the {@code TreeSet} constructor directly, taking advantage of "diamond" syntax.
   *
   * @return a new, empty {@code TreeSet}
   */
  @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
  public static <E extends Comparable> TreeSet<E> newTreeSet() {
    return new TreeSet<>();
  }

/**
   * Creates a mutable, empty {@code TreeSet} instance sorted by the natural sort ordering of
   * its elements.
   *
   *
Note: if mutability is not required, use {@code ImmutableSortedSet#of()} instead.
   *
   *
Note: this method is now unnecessary and should be treated as deprecated. Instead,
   * use the {@code TreeSet} constructor directly, taking advantage of "diamond" syntax.
   *
   * @return a new, empty {@code TreeSet}
   */
  @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
  public static <E extends Comparable> TreeSet<E> newTreeSet() {
    return new TreeSet<E>();
  }

Replace Generic With Diamond TreeSet<E> with TreeSet<> in method public newTreeSet() : TreeSet<E> from class dev.mccue.guava.collect.Sets


/**
   * Creates a mutable, empty {@code TreeSet} instance with the given comparator.
   *
   *
Note: if mutability is not required, use {@code
   * ImmutableSortedSet.orderedBy(comparator).build()} instead.
   *
   *
Note: this method is now unnecessary and should be treated as deprecated. Instead,
   * use the {@code TreeSet} constructor directly, taking advantage of "diamond" syntax. One caveat to this is that the {@code TreeSet}
   * constructor uses a null {@code Comparator} to mean "natural ordering," whereas this factory
   * rejects null. Clean your code accordingly.
   *
   * @param comparator the comparator to use to sort the set
   * @return a new, empty {@code TreeSet}
   * @throws NullPointerException if {@code comparator} is null
   */
  public static <E extends @Nullable Object> TreeSet<E> newTreeSet(
      Comparator<? super E> comparator) {
    return new TreeSet<>(checkNotNull(comparator));
  }

/**
   * Creates a mutable, empty {@code TreeSet} instance with the given comparator.
   *
   *
Note: if mutability is not required, use {@code
   * ImmutableSortedSet.orderedBy(comparator).build()} instead.
   *
   *
Note: this method is now unnecessary and should be treated as deprecated. Instead,
   * use the {@code TreeSet} constructor directly, taking advantage of "diamond" syntax. One caveat to this is that the {@code TreeSet}
   * constructor uses a null {@code Comparator} to mean "natural ordering," whereas this factory
   * rejects null. Clean your code accordingly.
   *
   * @param comparator the comparator to use to sort the set
   * @return a new, empty {@code TreeSet}
   * @throws NullPointerException if {@code comparator} is null
   */
  public static <E extends @Nullable Object> TreeSet<E> newTreeSet(
      Comparator<? super E> comparator) {
    return new TreeSet<E>(checkNotNull(comparator));
  }

Replace Generic With Diamond TreeSet<E> with TreeSet<> in method public newTreeSet(comparator Comparator<? super E>) : TreeSet<E> from class dev.mccue.guava.collect.Sets


/**
   * Creates an empty {@code CopyOnWriteArraySet} instance.
   *
   *
Note: if you need an immutable empty {@code Set}, use {@code Collections#emptySet}
   * instead.
   *
   * @return a new, empty {@code CopyOnWriteArraySet}
   * @since 12.0
   */
  // CopyOnWriteArraySet
  public static <E extends @Nullable Object> CopyOnWriteArraySet<E> newCopyOnWriteArraySet() {
    return new CopyOnWriteArraySet<>();
  }

/**
   * Creates an empty {@code CopyOnWriteArraySet} instance.
   *
   *
Note: if you need an immutable empty {@code Set}, use {@code Collections#emptySet}
   * instead.
   *
   * @return a new, empty {@code CopyOnWriteArraySet}
   * @since 12.0
   */
  // CopyOnWriteArraySet
  public static <E extends @Nullable Object> CopyOnWriteArraySet<E> newCopyOnWriteArraySet() {
    return new CopyOnWriteArraySet<E>();
  }

Replace Generic With Diamond CopyOnWriteArraySet<E> with CopyOnWriteArraySet<> in method public newCopyOnWriteArraySet() : CopyOnWriteArraySet<E> from class dev.mccue.guava.collect.Sets


  /**
   * Creates a {@code CopyOnWriteArraySet} instance containing the given elements.
   *
   * @param elements the elements that the set should contain, in order
   * @return a new {@code CopyOnWriteArraySet} containing those elements
   * @since 12.0
   */
  // CopyOnWriteArraySet
  public static <E extends @Nullable Object> CopyOnWriteArraySet<E> newCopyOnWriteArraySet(
      Iterable<? extends E> elements) {
    // We copy elements to an ArrayList first, rather than incurring the
    // quadratic cost of adding them to the COWAS directly.
    Collection<? extends E> elementsCollection =
        (elements instanceof Collection)
            ? (Collection<? extends E>) elements
            : Lists.newArrayList(elements);
    return new CopyOnWriteArraySet<>(elementsCollection);
  }

  /**
   * Creates a {@code CopyOnWriteArraySet} instance containing the given elements.
   *
   * @param elements the elements that the set should contain, in order
   * @return a new {@code CopyOnWriteArraySet} containing those elements
   * @since 12.0
   */
  // CopyOnWriteArraySet
  public static <E extends @Nullable Object> CopyOnWriteArraySet<E> newCopyOnWriteArraySet(
      Iterable<? extends E> elements) {
    // We copy elements to an ArrayList first, rather than incurring the
    // quadratic cost of adding them to the COWAS directly.
    Collection<? extends E> elementsCollection =
        (elements instanceof Collection)
            ? (Collection<? extends E>) elements
            : Lists.newArrayList(elements);
    return new CopyOnWriteArraySet<E>(elementsCollection);
  }

Replace Generic With Diamond CopyOnWriteArraySet<E> with CopyOnWriteArraySet<> in method public newCopyOnWriteArraySet(elements Iterable<? extends E>) : CopyOnWriteArraySet<E> from class dev.mccue.guava.collect.Sets


/**
   * Returns an unmodifiable view of the specified navigable set. This method allows modules to
   * provide users with "read-only" access to internal navigable sets. Query operations on the
   * returned set "read through" to the specified set, and attempts to modify the returned set,
   * whether direct or via its collection views, result in an {@code UnsupportedOperationException}.
   *
   *
The returned navigable set will be serializable if the specified navigable set is
   * serializable.
   *
   *
Java 8+ users and later: Prefer {@code Collections#unmodifiableNavigableSet}.
   *
   * @param set the navigable set for which an unmodifiable view is to be returned
   * @return an unmodifiable view of the specified navigable set
   * @since 12.0
   */
  public static <E extends @Nullable Object> NavigableSet<E> unmodifiableNavigableSet(
      NavigableSet<E> set) {
    if (set instanceof ImmutableCollection || set instanceof UnmodifiableNavigableSet) {
      return set;
    }
    return new UnmodifiableNavigableSet<>(set);
  }

/**
   * Returns an unmodifiable view of the specified navigable set. This method allows modules to
   * provide users with "read-only" access to internal navigable sets. Query operations on the
   * returned set "read through" to the specified set, and attempts to modify the returned set,
   * whether direct or via its collection views, result in an {@code UnsupportedOperationException}.
   *
   *
The returned navigable set will be serializable if the specified navigable set is
   * serializable.
   *
   *
Java 8+ users and later: Prefer {@code Collections#unmodifiableNavigableSet}.
   *
   * @param set the navigable set for which an unmodifiable view is to be returned
   * @return an unmodifiable view of the specified navigable set
   * @since 12.0
   */
  public static <E extends @Nullable Object> NavigableSet<E> unmodifiableNavigableSet(
      NavigableSet<E> set) {
    if (set instanceof ImmutableCollection || set instanceof UnmodifiableNavigableSet) {
      return set;
    }
    return new UnmodifiableNavigableSet<E>(set);
  }

Replace Generic With Diamond UnmodifiableNavigableSet<E> with UnmodifiableNavigableSet<> in method public unmodifiableNavigableSet(set NavigableSet<E>) : NavigableSet<E> from class dev.mccue.guava.collect.Sets


  private static <E extends @Nullable Object> Collection<E> collection(
      Collection<E> collection, @CheckForNull Object mutex) {
    return new SynchronizedCollection<>(collection, mutex);
  }

  private static <E extends @Nullable Object> Collection<E> collection(
      Collection<E> collection, @CheckForNull Object mutex) {
    return new SynchronizedCollection<E>(collection, mutex);
  }

Replace Generic With Diamond SynchronizedCollection<E> with SynchronizedCollection<> in method private collection(collection Collection<E>, mutex Object) : Collection<E> from class dev.mccue.guava.collect.Synchronized


  static <E extends @Nullable Object> Set<E> set(Set<E> set, @CheckForNull Object mutex) {
    return new SynchronizedSet<>(set, mutex);
  }

  static <E extends @Nullable Object> Set<E> set(Set<E> set, @CheckForNull Object mutex) {
    return new SynchronizedSet<E>(set, mutex);
  }

Replace Generic With Diamond SynchronizedSet<E> with SynchronizedSet<> in method package set(set Set<E>, mutex Object) : Set<E> from class dev.mccue.guava.collect.Synchronized


  private static <E extends @Nullable Object> SortedSet<E> sortedSet(
      SortedSet<E> set, @CheckForNull Object mutex) {
    return new SynchronizedSortedSet<>(set, mutex);
  }

  private static <E extends @Nullable Object> SortedSet<E> sortedSet(
      SortedSet<E> set, @CheckForNull Object mutex) {
    return new SynchronizedSortedSet<E>(set, mutex);
  }

Replace Generic With Diamond SynchronizedSortedSet<E> with SynchronizedSortedSet<> in method private sortedSet(set SortedSet<E>, mutex Object) : SortedSet<E> from class dev.mccue.guava.collect.Synchronized


  static <E extends @Nullable Object> Multiset<E> multiset(
      Multiset<E> multiset, @CheckForNull Object mutex) {
    if (multiset instanceof SynchronizedMultiset || multiset instanceof ImmutableMultiset) {
      return multiset;
    }
    return new SynchronizedMultiset<>(multiset, mutex);
  }

  static <E extends @Nullable Object> Multiset<E> multiset(
      Multiset<E> multiset, @CheckForNull Object mutex) {
    if (multiset instanceof SynchronizedMultiset || multiset instanceof ImmutableMultiset) {
      return multiset;
    }
    return new SynchronizedMultiset<E>(multiset, mutex);
  }

Replace Generic With Diamond SynchronizedMultiset<E> with SynchronizedMultiset<> in method package multiset(multiset Multiset<E>, mutex Object) : Multiset<E> from class dev.mccue.guava.collect.Synchronized


  static <E extends @Nullable Object> NavigableSet<E> navigableSet(
      NavigableSet<E> navigableSet, @CheckForNull Object mutex) {
    return new SynchronizedNavigableSet<>(navigableSet, mutex);
  }

  static <E extends @Nullable Object> NavigableSet<E> navigableSet(
      NavigableSet<E> navigableSet, @CheckForNull Object mutex) {
    return new SynchronizedNavigableSet<E>(navigableSet, mutex);
  }

Replace Generic With Diamond SynchronizedNavigableSet<E> with SynchronizedNavigableSet<> in method package navigableSet(navigableSet NavigableSet<E>, mutex Object) : NavigableSet<E> from class dev.mccue.guava.collect.Synchronized


  static <E extends @Nullable Object> Deque<E> deque(Deque<E> deque, @CheckForNull Object mutex) {
    return new SynchronizedDeque<>(deque, mutex);
  }

  static <E extends @Nullable Object> Deque<E> deque(Deque<E> deque, @CheckForNull Object mutex) {
    return new SynchronizedDeque<E>(deque, mutex);
  }

Replace Generic With Diamond SynchronizedDeque<E> with SynchronizedDeque<> in method package deque(deque Deque<E>, mutex Object) : Deque<E> from class dev.mccue.guava.collect.Synchronized


  /**
   * Returns a {@code TopKSelector} that collects the lowest {@code k} elements added to it,
   * relative to the specified comparator, and returns them via {@code #topK} in ascending order.
   *
   * @throws IllegalArgumentException if {@code k < 0} or {@code k > Integer.MAX_VALUE / 2}
   */
  public static <T extends @Nullable Object> TopKSelector<T> least(
      int k, Comparator<? super T> comparator) {
    return new TopKSelector<>(comparator, k);
  }

  /**
   * Returns a {@code TopKSelector} that collects the lowest {@code k} elements added to it,
   * relative to the specified comparator, and returns them via {@code #topK} in ascending order.
   *
   * @throws IllegalArgumentException if {@code k < 0} or {@code k > Integer.MAX_VALUE / 2}
   */
  public static <T extends @Nullable Object> TopKSelector<T> least(
      int k, Comparator<? super T> comparator) {
    return new TopKSelector<T>(comparator, k);
  }

Replace Generic With Diamond TopKSelector<T> with TopKSelector<> in method public least(k int, comparator Comparator<? super T>) : TopKSelector<T> from class dev.mccue.guava.collect.TopKSelector