Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ protected List<TestSuite> createDerivedSuites(

if (parentBuilder.getFeatures().contains(SERIALIZABLE)) {
derivedSuites.add(
CollectionTestSuiteBuilder.using(
new ReserializedCollectionGenerator<E>(parentBuilder.getSubjectGenerator()))
using(new ReserializedCollectionGenerator<E>(parentBuilder.getSubjectGenerator()))
.named(getName() + " reserialized")
.withFeatures(computeReserializedCollectionFeatures(parentBuilder.getFeatures()))
.suppressing(parentBuilder.getSuppressedTests())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ protected List<TestSuite> createDerivedSuites(

if (parentBuilder.getFeatures().contains(SERIALIZABLE)) {
derivedSuites.add(
ListTestSuiteBuilder.using(
new ReserializedListGenerator<E>(parentBuilder.getSubjectGenerator()))
using(new ReserializedListGenerator<E>(parentBuilder.getSubjectGenerator()))
.named(getName() + " reserialized")
.withFeatures(computeReserializedCollectionFeatures(parentBuilder.getFeatures()))
.suppressing(parentBuilder.getSuppressedTests())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ protected List<TestSuite> createDerivedSuites(

if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
derivedSuites.add(
MapTestSuiteBuilder.using(
new ReserializedMapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
using(new ReserializedMapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
.withFeatures(computeReserializedMapFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " reserialized")
.suppressing(parentBuilder.getSuppressedTests())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ protected List<TestSuite> createDerivedSuites(

if (parentBuilder.getFeatures().contains(SERIALIZABLE)) {
derivedSuites.add(
SetTestSuiteBuilder.using(
new ReserializedSetGenerator<E>(parentBuilder.getSubjectGenerator()))
using(new ReserializedSetGenerator<E>(parentBuilder.getSubjectGenerator()))
.named(getName() + " reserialized")
.withFeatures(computeReserializedCollectionFeatures(parentBuilder.getFeatures()))
.suppressing(parentBuilder.getSuppressedTests())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ protected List<TestSuite> createDerivedSuites(
.createTestSuite());
if (!parentBuilder.getFeatures().contains(NoRecurse.INVERSE)) {
derived.add(
BiMapTestSuiteBuilder.using(
new InverseBiMapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
using(new InverseBiMapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
.withFeatures(computeInverseFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " inverse")
.suppressing(parentBuilder.getSuppressedTests())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ protected List<TestSuite> createDerivedSuites(

if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
derivedSuites.add(
MultimapTestSuiteBuilder.using(
new ReserializedMultimapGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
using(new ReserializedMultimapGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
.withFeatures(computeReserializedMultimapFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " reserialized")
.suppressing(parentBuilder.getSuppressedTests())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ protected List<TestSuite> createDerivedSuites(

if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
derivedSuites.add(
MultisetTestSuiteBuilder.using(
new ReserializedMultisetGenerator<E>(parentBuilder.getSubjectGenerator()))
using(new ReserializedMultisetGenerator<E>(parentBuilder.getSubjectGenerator()))
.named(getName() + " reserialized")
.withFeatures(computeReserializedMultisetFeatures(parentBuilder.getFeatures()))
.suppressing(parentBuilder.getSuppressedTests())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private TestSuite createSubMultisetSuite(
E firstInclusive = samplesList.get(0);
E lastInclusive = samplesList.get(samplesList.size() - 1);

return SortedMultisetTestSuiteBuilder.using(
return using(
new ForwardingTestMultisetGenerator<E>(delegate) {
@Override
public SortedMultiset<E> create(Object... entries) {
Expand Down Expand Up @@ -244,7 +244,7 @@ private TestSuite createDescendingSuite(SortedMultisetTestSuiteBuilder<E> parent
features.remove(SERIALIZABLE);
}

return SortedMultisetTestSuiteBuilder.using(
return using(
new ForwardingTestMultisetGenerator<E>(delegate) {
@Override
public SortedMultiset<E> create(Object... entries) {
Expand All @@ -270,7 +270,7 @@ private TestSuite createReserializedSuite(SortedMultisetTestSuiteBuilder<E> pare
features.remove(SERIALIZABLE);
features.remove(SERIALIZABLE_INCLUDING_VIEWS);

return SortedMultisetTestSuiteBuilder.using(
return using(
new ForwardingTestMultisetGenerator<E>(delegate) {
@Override
public SortedMultiset<E> create(Object... entries) {
Expand Down
2 changes: 1 addition & 1 deletion android/guava/src/com/google/common/base/Optional.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static <T> Optional<T> of(T reference) {
* {@code Optional.ofNullable}.
*/
public static <T> Optional<T> fromNullable(@Nullable T nullableReference) {
return (nullableReference == null) ? Optional.absent() : new Present<>(nullableReference);
return nullableReference == null ? absent() : new Present<>(nullableReference);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion android/guava/src/com/google/common/base/Splitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ int separatorEnd(int separatorPosition) {
public static Splitter on(String separator) {
checkArgument(!separator.isEmpty(), "The separator may not be the empty string.");
if (separator.length() == 1) {
return Splitter.on(separator.charAt(0));
return on(separator.charAt(0));
}
return new Splitter(
(splitter, toSplit) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static CacheBuilderSpec parse(String cacheBuilderSpecification) {
/** Returns a CacheBuilderSpec that will prevent caching. */
public static CacheBuilderSpec disableCaching() {
// Maximum size of zero is one way to block caching
return CacheBuilderSpec.parse("maximumSize=0");
return parse("maximumSize=0");
}

/** Returns a CacheBuilder configured according to this instance's specification. */
Expand Down
9 changes: 4 additions & 5 deletions android/guava/src/com/google/common/cache/LocalCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ final class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<
removalListener = builder.getRemovalListener();
removalNotificationQueue =
(removalListener == NullListener.INSTANCE)
? LocalCache.discardingQueue()
? discardingQueue()
: new ConcurrentLinkedQueue<>();

ticker = builder.getTicker(recordsTime());
Expand Down Expand Up @@ -1972,12 +1972,11 @@ static final class Segment<K, V> extends ReentrantLock {

valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<>() : null;

recencyQueue =
map.usesAccessQueue() ? new ConcurrentLinkedQueue<>() : LocalCache.discardingQueue();
recencyQueue = map.usesAccessQueue() ? new ConcurrentLinkedQueue<>() : discardingQueue();

writeQueue = map.usesWriteQueue() ? new WriteQueue<>() : LocalCache.discardingQueue();
writeQueue = map.usesWriteQueue() ? new WriteQueue<>() : discardingQueue();

accessQueue = map.usesAccessQueue() ? new AccessQueue<>() : LocalCache.discardingQueue();
accessQueue = map.usesAccessQueue() ? new AccessQueue<>() : discardingQueue();
}

AtomicReferenceArray<ReferenceEntry<K, V>> newEntryArray(int size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Iterator<? extends T> get(int i) {
*/
@SuppressWarnings("EmptyList") // ImmutableList doesn't support nullable element types
public static <E extends @Nullable Object> FluentIterable<E> of() {
return FluentIterable.from(emptyList());
return from(emptyList());
}

/**
Expand Down Expand Up @@ -401,7 +401,7 @@ public final FluentIterable<E> cycle() {
* @since 18.0
*/
public final FluentIterable<E> append(Iterable<? extends E> other) {
return FluentIterable.concat(getDelegate(), other);
return concat(getDelegate(), other);
}

/**
Expand All @@ -413,7 +413,7 @@ public final FluentIterable<E> append(Iterable<? extends E> other) {
* @since 18.0
*/
public final FluentIterable<E> append(E... elements) {
return FluentIterable.concat(getDelegate(), asList(elements));
return concat(getDelegate(), asList(elements));
}

/**
Expand Down Expand Up @@ -507,7 +507,7 @@ public final boolean allMatch(Predicate<? super E> predicate) {
*/
public <T extends @Nullable Object> FluentIterable<T> transformAndConcat(
Function<? super E, ? extends Iterable<? extends T>> function) {
return FluentIterable.concat(transform(function));
return concat(transform(function));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,22 @@ public static <K, V> ImmutableListMultimap<K, V> of() {

/** Returns an immutable multimap containing a single entry. */
public static <K, V> ImmutableListMultimap<K, V> of(K k1, V v1) {
ImmutableListMultimap.Builder<K, V> builder = ImmutableListMultimap.builder();
ImmutableListMultimap.Builder<K, V> builder = builder();
builder.put(k1, v1);
return builder.build();
}

/** Returns an immutable multimap containing the given entries, in order. */
public static <K, V> ImmutableListMultimap<K, V> of(K k1, V v1, K k2, V v2) {
ImmutableListMultimap.Builder<K, V> builder = ImmutableListMultimap.builder();
ImmutableListMultimap.Builder<K, V> builder = builder();
builder.put(k1, v1);
builder.put(k2, v2);
return builder.build();
}

/** Returns an immutable multimap containing the given entries, in order. */
public static <K, V> ImmutableListMultimap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3) {
ImmutableListMultimap.Builder<K, V> builder = ImmutableListMultimap.builder();
ImmutableListMultimap.Builder<K, V> builder = builder();
builder.put(k1, v1);
builder.put(k2, v2);
builder.put(k3, v3);
Expand All @@ -166,7 +166,7 @@ public static <K, V> ImmutableListMultimap<K, V> of(K k1, V v1, K k2, V v2, K k3
/** Returns an immutable multimap containing the given entries, in order. */
public static <K, V> ImmutableListMultimap<K, V> of(
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
ImmutableListMultimap.Builder<K, V> builder = ImmutableListMultimap.builder();
ImmutableListMultimap.Builder<K, V> builder = builder();
builder.put(k1, v1);
builder.put(k2, v2);
builder.put(k3, v3);
Expand All @@ -177,7 +177,7 @@ public static <K, V> ImmutableListMultimap<K, V> of(
/** Returns an immutable multimap containing the given entries, in order. */
public static <K, V> ImmutableListMultimap<K, V> of(
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
ImmutableListMultimap.Builder<K, V> builder = ImmutableListMultimap.builder();
ImmutableListMultimap.Builder<K, V> builder = builder();
builder.put(k1, v1);
builder.put(k2, v2);
builder.put(k3, v3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public static <E> ImmutableMultiset<E> copyOf(Iterable<? extends E> elements) {
}
}
ImmutableMultiset.Builder<E> builder =
new ImmutableMultiset.Builder<E>(Multisets.inferDistinctElements(elements));
new ImmutableMultiset.Builder<>(Multisets.inferDistinctElements(elements));
builder.addAll(elements);
return builder.build();
}
Expand All @@ -210,7 +210,7 @@ private static <E> ImmutableMultiset<E> copyFromElements(E... elements) {

static <E> ImmutableMultiset<E> copyFromEntries(
Collection<? extends Entry<? extends E>> entries) {
ImmutableMultiset.Builder<E> builder = new ImmutableMultiset.Builder<E>(entries.size());
ImmutableMultiset.Builder<E> builder = new ImmutableMultiset.Builder<>(entries.size());
for (Entry<? extends E> entry : entries) {
builder.addCopies(entry.getElement(), entry.getCount());
}
Expand Down Expand Up @@ -401,7 +401,7 @@ public int hashCode() {
@J2ktIncompatible
@Override
Object writeReplace() {
return new EntrySetSerializedForm<E>(ImmutableMultiset.this);
return new EntrySetSerializedForm<>(ImmutableMultiset.this);
}

@GwtIncompatible
Expand Down Expand Up @@ -548,7 +548,7 @@ public Builder<E> addCopies(E element, int occurrences) {
return this;
}
if (buildInvoked) {
contents = new ObjectCountHashMap<E>(contents);
contents = new ObjectCountHashMap<>(contents);
isLinkedHash = false;
}
buildInvoked = false;
Expand All @@ -571,12 +571,12 @@ public Builder<E> addCopies(E element, int occurrences) {
public Builder<E> setCount(E element, int count) {
requireNonNull(contents); // see the comment on the field
if (count == 0 && !isLinkedHash) {
contents = new ObjectCountLinkedHashMap<E>(contents);
contents = new ObjectCountLinkedHashMap<>(contents);
isLinkedHash = true;
// to preserve insertion order through deletions, we have to switch to an actual linked
// implementation at least for now, but this should be a super rare case
} else if (buildInvoked) {
contents = new ObjectCountHashMap<E>(contents);
contents = new ObjectCountHashMap<>(contents);
isLinkedHash = false;
}
buildInvoked = false;
Expand Down Expand Up @@ -663,12 +663,12 @@ public ImmutableMultiset<E> build() {
if (isLinkedHash) {
// we need ObjectCountHashMap-backed contents, with its keys and values array in direct
// insertion order
contents = new ObjectCountHashMap<E>(contents);
contents = new ObjectCountHashMap<>(contents);
isLinkedHash = false;
}
buildInvoked = true;
// contents is now ObjectCountHashMap, but still guaranteed to be in insertion order!
return new RegularImmutableMultiset<E>(contents);
return new RegularImmutableMultiset<>(contents);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public ImmutableMap<Range<K>, V> asDescendingMapOfRanges() {
@Override
public ImmutableRangeMap<K, V> subRangeMap(Range<K> range) {
if (checkNotNull(range).isEmpty()) {
return ImmutableRangeMap.of();
return of();
} else if (ranges.isEmpty() || range.encloses(span())) {
return this;
}
Expand All @@ -330,7 +330,7 @@ public ImmutableRangeMap<K, V> subRangeMap(Range<K> range) {
KeyPresentBehavior.ANY_PRESENT,
KeyAbsentBehavior.NEXT_HIGHER);
if (lowerIndex >= upperIndex) {
return ImmutableRangeMap.of();
return of();
}
int off = lowerIndex;
int len = upperIndex - lowerIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public static <K, V> ImmutableSetMultimap<K, V> of() {

/** Returns an immutable multimap containing a single entry. */
public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1) {
ImmutableSetMultimap.Builder<K, V> builder = ImmutableSetMultimap.builder();
ImmutableSetMultimap.Builder<K, V> builder = builder();
builder.put(k1, v1);
return builder.build();
}
Expand All @@ -170,7 +170,7 @@ public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1) {
* an entry (according to {@link Object#equals}) after the first are ignored.
*/
public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1, K k2, V v2) {
ImmutableSetMultimap.Builder<K, V> builder = ImmutableSetMultimap.builder();
ImmutableSetMultimap.Builder<K, V> builder = builder();
builder.put(k1, v1);
builder.put(k2, v2);
return builder.build();
Expand All @@ -181,7 +181,7 @@ public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1, K k2, V v2) {
* an entry (according to {@link Object#equals}) after the first are ignored.
*/
public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3) {
ImmutableSetMultimap.Builder<K, V> builder = ImmutableSetMultimap.builder();
ImmutableSetMultimap.Builder<K, V> builder = builder();
builder.put(k1, v1);
builder.put(k2, v2);
builder.put(k3, v3);
Expand All @@ -194,7 +194,7 @@ public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1, K k2, V v2, K k3,
*/
public static <K, V> ImmutableSetMultimap<K, V> of(
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
ImmutableSetMultimap.Builder<K, V> builder = ImmutableSetMultimap.builder();
ImmutableSetMultimap.Builder<K, V> builder = builder();
builder.put(k1, v1);
builder.put(k2, v2);
builder.put(k3, v3);
Expand All @@ -208,7 +208,7 @@ public static <K, V> ImmutableSetMultimap<K, V> of(
*/
public static <K, V> ImmutableSetMultimap<K, V> of(
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
ImmutableSetMultimap.Builder<K, V> builder = ImmutableSetMultimap.builder();
ImmutableSetMultimap.Builder<K, V> builder = builder();
builder.put(k1, v1);
builder.put(k2, v2);
builder.put(k3, v3);
Expand Down Expand Up @@ -396,7 +396,7 @@ public Builder<K, V> orderValuesBy(Comparator<? super V> valueComparator) {
@Override
public ImmutableSetMultimap<K, V> build() {
if (builderMap == null) {
return ImmutableSetMultimap.of();
return of();
}
Collection<Map.Entry<K, ImmutableCollection.Builder<V>>> mapEntries = builderMap.entrySet();
if (keyComparator != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,7 @@ public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(
V v8,
K k9,
V v9) {
/*
* This explicit type parameter works around what seems to be a javac bug in certain
* configurations: b/339186525#comment6
*/
return ImmutableSortedMap.fromEntries(
return fromEntries(
entryOf(k1, v1),
entryOf(k2, v2),
entryOf(k3, v3),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static <R, C, V> ImmutableTable<R, C, V> copyOf(

static <R, C, V> ImmutableTable<R, C, V> copyOf(
Iterable<? extends Cell<? extends R, ? extends C, ? extends V>> cells) {
ImmutableTable.Builder<R, C, V> builder = ImmutableTable.builder();
ImmutableTable.Builder<R, C, V> builder = builder();
for (Cell<? extends R, ? extends C, ? extends V> cell : cells) {
builder.put(cell);
}
Expand Down
2 changes: 1 addition & 1 deletion android/guava/src/com/google/common/collect/Sets.java
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ NavigableSet<E> unfiltered() {

@Override
public NavigableSet<E> descendingSet() {
return Sets.filter(unfiltered().descendingSet(), predicate);
return filter(unfiltered().descendingSet(), predicate);
}

@Override
Expand Down
Loading
Loading