Code cleanup and remove renderworldevent.

This commit is contained in:
BuildTools 2023-01-01 11:26:38 -07:00
parent 77ee59589f
commit 2e1287ba9d
851 changed files with 119019 additions and 876513 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -16,15 +16,14 @@
package com.google.common.base;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.Serializable;
import javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import javax.annotation.Nullable;
import java.io.Serializable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Utility class for converting between various ASCII case formats. Behavior is
* undefined for non-ASCII input.
@ -222,7 +221,7 @@ public enum CaseFormat {
private static String firstCharOnlyToUpper(String word) {
return (word.isEmpty()) ? word
: new StringBuilder(word.length()).append(Ascii.toUpperCase(word.charAt(0)))
.append(Ascii.toLowerCase(word.substring(1))).toString();
: Ascii.toUpperCase(word.charAt(0)) +
Ascii.toLowerCase(word.substring(1));
}
}

View File

@ -16,18 +16,17 @@
package com.google.common.base;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Arrays;
import java.util.BitSet;
import javax.annotation.CheckReturnValue;
import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import javax.annotation.CheckReturnValue;
import java.util.Arrays;
import java.util.BitSet;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Determines a true or false value for any Java {@code char} value, just as
* {@link Predicate} does for any {@link Object}. Also offers basic text
@ -914,7 +913,7 @@ public abstract class CharMatcher implements Predicate<Character> {
}
@Override
public final CharMatcher precomputed() {
public CharMatcher precomputed() {
return this;
}

View File

@ -16,10 +16,10 @@
package com.google.common.base;
import java.nio.charset.Charset;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
/**
* Contains constant definitions for the six standard {@link Charset} instances,
@ -44,9 +44,8 @@ public final class Charsets {
/**
* UTF-8: eight-bit UCS Transformation Format.
*
*/
public static final Charset UTF_8 = Charset.forName("UTF-8");
public static final Charset UTF_8 = StandardCharsets.UTF_8;
/*
* Please do not add new Charset references to this class, unless those

View File

@ -57,7 +57,7 @@ public final class Objects {
*/
@CheckReturnValue
public static boolean equal(@Nullable Object a, @Nullable Object b) {
return a == b || (a != null && a.equals(b));
return java.util.Objects.equals(a, b);
}
/**
@ -213,7 +213,7 @@ public final class Objects {
*/
public static final class ToStringHelper {
private final String className;
private ValueHolder holderHead = new ValueHolder();
private final ValueHolder holderHead = new ValueHolder();
private ValueHolder holderTail = holderHead;
private boolean omitNullValues = false;

View File

@ -100,7 +100,7 @@ public abstract class Optional<T> implements Serializable {
* {@link Optional#absent}.
*/
public static <T> Optional<T> fromNullable(@Nullable T nullableReference) {
return (nullableReference == null) ? Optional.<T>absent() : new Present<T>(nullableReference);
return (nullableReference == null) ? Optional.absent() : new Present<T>(nullableReference);
}
Optional() {

View File

@ -41,6 +41,6 @@ final class Platform {
static <T extends Enum<T>> Optional<T> getEnumIfPresent(Class<T> enumClass, String value) {
WeakReference<? extends Enum<?>> ref = Enums.getEnumConstants(enumClass).get(value);
return ref == null ? Optional.<T>absent() : Optional.of(enumClass.cast(ref.get()));
return ref == null ? Optional.absent() : Optional.of(enumClass.cast(ref.get()));
}
}

View File

@ -472,7 +472,7 @@ public final class Preconditions {
*/
// Note that this is somewhat-improperly used from Verify.java as well.
static String format(String template, @Nullable Object... args) {
template = String.valueOf(template); // null -> "null"
template = template; // null -> "null"
// start substituting the arguments into the '%s' placeholders
StringBuilder builder = new StringBuilder(template.length() + 16 * args.length);
@ -483,7 +483,7 @@ public final class Preconditions {
if (placeholderStart == -1) {
break;
}
builder.append(template.substring(templateStart, placeholderStart));
builder.append(template, templateStart, placeholderStart);
builder.append(args[i++]);
templateStart = placeholderStart + 2;
}

View File

@ -128,7 +128,7 @@ public final class Predicates {
* evaluation will be "short-circuited" as soon as a false predicate is found.
*/
public static <T> Predicate<T> and(Predicate<? super T> first, Predicate<? super T> second) {
return new AndPredicate<T>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second)));
return new AndPredicate<T>(Predicates.asList(checkNotNull(first), checkNotNull(second)));
}
/**
@ -164,7 +164,7 @@ public final class Predicates {
* found.
*/
public static <T> Predicate<T> or(Predicate<? super T> first, Predicate<? super T> second) {
return new OrPredicate<T>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second)));
return new OrPredicate<T>(Predicates.asList(checkNotNull(first), checkNotNull(second)));
}
/**
@ -172,7 +172,7 @@ public final class Predicates {
* {@code equals()} the given target or both are null.
*/
public static <T> Predicate<T> equalTo(@Nullable T target) {
return (target == null) ? Predicates.<T>isNull() : new IsEqualToPredicate<T>(target);
return (target == null) ? Predicates.isNull() : new IsEqualToPredicate<T>(target);
}
/**
@ -693,7 +693,7 @@ public final class Predicates {
private static <T> List<Predicate<? super T>> asList(Predicate<? super T> first, Predicate<? super T> second) {
// TODO(kevinb): understand why we still get a warning despite @SafeVarargs!
return Arrays.<Predicate<? super T>>asList(first, second);
return Arrays.asList(first, second);
}
private static <T> List<T> defensiveCopy(T... array) {

View File

@ -115,7 +115,7 @@ public enum StandardSystemProperty {
private final String key;
private StandardSystemProperty(String key) {
StandardSystemProperty(String key) {
this.key = key;
}

View File

@ -65,7 +65,7 @@ public final class Throwables {
public static <X extends Throwable> void propagateIfInstanceOf(@Nullable Throwable throwable, Class<X> declaredType)
throws X {
// Check for null is needed to avoid frequent JNI calls to isInstance().
if (throwable != null && declaredType.isInstance(throwable)) {
if (declaredType.isInstance(throwable)) {
throw declaredType.cast(throwable);
}
}

View File

@ -50,7 +50,7 @@ abstract class AbstractRangeSet<C extends Comparable> implements RangeSet<C> {
@Override
public void clear() {
remove(Range.<C>all());
remove(Range.all());
}
@Override

View File

@ -16,20 +16,16 @@
package com.google.common.collect;
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.VisibleForTesting;
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
/**
* Implementation of {@code Multimap} that uses an {@code ArrayList} to store
@ -114,7 +110,7 @@ public final class ArrayListMultimap<K, V> extends AbstractListMultimap<K, V> {
}
private ArrayListMultimap(int expectedKeys, int expectedValuesPerKey) {
super(Maps.<K, Collection<V>>newHashMapWithExpectedSize(expectedKeys));
super(Maps.newHashMapWithExpectedSize(expectedKeys));
checkNonnegative(expectedValuesPerKey, "expectedValuesPerKey");
this.expectedValuesPerKey = expectedValuesPerKey;
}

View File

@ -16,26 +16,18 @@
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkElementIndex;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Objects;
import javax.annotation.Nullable;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.*;
import static com.google.common.base.Preconditions.*;
/**
* Fixed-size {@link Table} implementation backed by a two-dimensional array.
*
@ -614,7 +606,7 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, V> implements
public Map<R, V> column(C columnKey) {
checkNotNull(columnKey);
Integer columnIndex = columnKeyToIndex.get(columnKey);
return (columnIndex == null) ? ImmutableMap.<R, V>of() : new Column(columnIndex);
return (columnIndex == null) ? ImmutableMap.of() : new Column(columnIndex);
}
private class Column extends ArrayMap<R, V> {
@ -702,7 +694,7 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, V> implements
public Map<C, V> row(R rowKey) {
checkNotNull(rowKey);
Integer rowIndex = rowKeyToIndex.get(rowKey);
return (rowIndex == null) ? ImmutableMap.<C, V>of() : new Row(rowIndex);
return (rowIndex == null) ? ImmutableMap.of() : new Row(rowIndex);
}
private class Row extends ArrayMap<C, V> {

View File

@ -16,25 +16,6 @@
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.and;
import static com.google.common.base.Predicates.in;
import static com.google.common.base.Predicates.not;
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
import static com.google.common.math.LongMath.binomial;
import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Function;
@ -44,6 +25,15 @@ import com.google.common.base.Predicates;
import com.google.common.math.IntMath;
import com.google.common.primitives.Ints;
import javax.annotation.Nullable;
import java.util.*;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.*;
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
import static com.google.common.math.LongMath.binomial;
/**
* Provides static methods for working with {@code Collection} instances.
*
@ -298,7 +288,7 @@ public final class Collections2 {
}
/**
* An implementation of {@link Collection#toString()}.
* An implementation of {@link Collection.toString()}.
*/
static String toStringImpl(final Collection<?> collection) {
StringBuilder sb = newStringBuilderForCollection(collection.size()).append('[');

View File

@ -16,18 +16,18 @@
package com.google.common.collect;
import com.google.common.annotations.GwtCompatible;
import java.io.Serializable;
import java.util.Comparator;
import com.google.common.annotations.GwtCompatible;
/** An ordering that tries several comparators in order. */
@GwtCompatible(serializable = true)
final class CompoundOrdering<T> extends Ordering<T> implements Serializable {
final ImmutableList<Comparator<? super T>> comparators;
CompoundOrdering(Comparator<? super T> primary, Comparator<? super T> secondary) {
this.comparators = ImmutableList.<Comparator<? super T>>of(primary, secondary);
this.comparators = ImmutableList.of(primary, secondary);
}
CompoundOrdering(Iterable<? extends Comparator<? super T>> comparators) {

View File

@ -14,15 +14,14 @@
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.GwtCompatible;
import com.google.common.primitives.Booleans;
import javax.annotation.Nullable;
import java.io.Serializable;
import java.util.NoSuchElementException;
import javax.annotation.Nullable;
import com.google.common.annotations.GwtCompatible;
import com.google.common.primitives.Booleans;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Implementation detail for the internal structure of {@link Range} instances.
@ -175,7 +174,7 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ
@Override
Cut<Comparable<?>> canonical(DiscreteDomain<Comparable<?>> domain) {
try {
return Cut.<Comparable<?>>belowValue(domain.minValue());
return Cut.belowValue(domain.minValue());
} catch (NoSuchElementException e) {
return this;
}
@ -313,7 +312,7 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ
case OPEN:
@Nullable
C previous = domain.previous(endpoint);
return (previous == null) ? Cut.<C>belowAll() : new AboveValue<C>(previous);
return (previous == null) ? Cut.belowAll() : new AboveValue<C>(previous);
default:
throw new AssertionError();
}
@ -325,7 +324,7 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ
case CLOSED:
@Nullable
C previous = domain.previous(endpoint);
return (previous == null) ? Cut.<C>aboveAll() : new AboveValue<C>(previous);
return (previous == null) ? Cut.aboveAll() : new AboveValue<C>(previous);
case OPEN:
return this;
default:
@ -398,7 +397,7 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ
case CLOSED:
@Nullable
C next = domain.next(endpoint);
return (next == null) ? Cut.<C>belowAll() : belowValue(next);
return (next == null) ? Cut.belowAll() : belowValue(next);
default:
throw new AssertionError();
}
@ -410,7 +409,7 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ
case OPEN:
@Nullable
C next = domain.next(endpoint);
return (next == null) ? Cut.<C>aboveAll() : belowValue(next);
return (next == null) ? Cut.aboveAll() : belowValue(next);
case CLOSED:
return this;
default:
@ -441,7 +440,7 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ
@Override
Cut<C> canonical(DiscreteDomain<C> domain) {
C next = leastValueAbove(domain);
return (next != null) ? belowValue(next) : Cut.<C>aboveAll();
return (next != null) ? belowValue(next) : Cut.aboveAll();
}
@Override

View File

@ -16,13 +16,13 @@
package com.google.common.collect;
import com.google.common.annotations.GwtCompatible;
import java.util.Comparator;
import java.util.Iterator;
import java.util.NavigableSet;
import java.util.Set;
import com.google.common.annotations.GwtCompatible;
/**
* A skeleton implementation of a descending multiset. Only needs
* {@code forwardMultiset()} and {@code entryIterator()}.
@ -39,7 +39,7 @@ abstract class DescendingMultiset<E> extends ForwardingMultiset<E> implements So
public Comparator<? super E> comparator() {
Comparator<? super E> result = comparator;
if (result == null) {
return comparator = Ordering.from(forwardMultiset().comparator()).<E>reverse();
return comparator = Ordering.from(forwardMultiset().comparator()).reverse();
}
return result;
}

View File

@ -28,7 +28,7 @@ class EmptyImmutableListMultimap extends ImmutableListMultimap<Object, Object> {
static final EmptyImmutableListMultimap INSTANCE = new EmptyImmutableListMultimap();
private EmptyImmutableListMultimap() {
super(ImmutableMap.<Object, ImmutableList<Object>>of(), 0);
super(ImmutableMap.of(), 0);
}
private Object readResolve() {

View File

@ -16,12 +16,11 @@
package com.google.common.collect;
import java.util.Collection;
import java.util.Set;
import com.google.common.annotations.GwtCompatible;
import javax.annotation.Nullable;
import com.google.common.annotations.GwtCompatible;
import java.util.Collection;
import java.util.Set;
/**
* An empty immutable set.
@ -85,7 +84,7 @@ final class EmptyImmutableSet extends ImmutableSet<Object> {
}
@Override
public final int hashCode() {
public int hashCode() {
return 0;
}

View File

@ -28,7 +28,7 @@ class EmptyImmutableSetMultimap extends ImmutableSetMultimap<Object, Object> {
static final EmptyImmutableSetMultimap INSTANCE = new EmptyImmutableSetMultimap();
private EmptyImmutableSetMultimap() {
super(ImmutableMap.<Object, ImmutableSet<Object>>of(), 0, null);
super(ImmutableMap.of(), 0, null);
}
private Object readResolve() {

View File

@ -76,7 +76,7 @@ public final class EnumHashBiMap<K extends Enum<K>, V> extends AbstractBiMap<K,
private EnumHashBiMap(Class<K> keyType) {
super(WellBehavedMap.wrap(new EnumMap<K, V>(keyType)),
Maps.<V, K>newHashMapWithExpectedSize(keyType.getEnumConstants().length));
Maps.newHashMapWithExpectedSize(keyType.getEnumConstants().length));
this.keyType = keyType;
}

View File

@ -104,7 +104,7 @@ class FilteredEntryMultimap<K, V> extends AbstractMultimap<K, V> implements Filt
Collection<V> unmodifiableEmptyCollection() {
// These return false, rather than throwing a UOE, on remove calls.
return (unfiltered instanceof SetMultimap) ? Collections.<V>emptySet() : Collections.<V>emptyList();
return (unfiltered instanceof SetMultimap) ? Collections.emptySet() : Collections.emptyList();
}
@Override
@ -215,12 +215,12 @@ class FilteredEntryMultimap<K, V> extends AbstractMultimap<K, V> implements Filt
return new Maps.KeySet<K, Collection<V>>(this) {
@Override
public boolean removeAll(Collection<?> c) {
return removeEntriesIf(Maps.<K>keyPredicateOnEntries(in(c)));
return removeEntriesIf(Maps.keyPredicateOnEntries(in(c)));
}
@Override
public boolean retainAll(Collection<?> c) {
return removeEntriesIf(Maps.<K>keyPredicateOnEntries(not(in(c))));
return removeEntriesIf(Maps.keyPredicateOnEntries(not(in(c))));
}
@Override
@ -303,12 +303,12 @@ class FilteredEntryMultimap<K, V> extends AbstractMultimap<K, V> implements Filt
@Override
public boolean removeAll(Collection<?> c) {
return removeEntriesIf(Maps.<Collection<V>>valuePredicateOnEntries(in(c)));
return removeEntriesIf(Maps.valuePredicateOnEntries(in(c)));
}
@Override
public boolean retainAll(Collection<?> c) {
return removeEntriesIf(Maps.<Collection<V>>valuePredicateOnEntries(not(in(c))));
return removeEntriesIf(Maps.valuePredicateOnEntries(not(in(c))));
}
};
}

View File

@ -75,16 +75,16 @@ final class FilteredMultimapValues<K, V> extends AbstractCollection<V> {
public boolean removeAll(Collection<?> c) {
return Iterables.removeIf(multimap.unfiltered().entries(),
// explicit <Entry<K, V>> is required to build with JDK6
Predicates.<Entry<K, V>>and(multimap.entryPredicate(),
Maps.<V>valuePredicateOnEntries(Predicates.in(c))));
Predicates.and(multimap.entryPredicate(),
Maps.valuePredicateOnEntries(Predicates.in(c))));
}
@Override
public boolean retainAll(Collection<?> c) {
return Iterables.removeIf(multimap.unfiltered().entries(),
// explicit <Entry<K, V>> is required to build with JDK6
Predicates.<Entry<K, V>>and(multimap.entryPredicate(),
Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c)))));
Predicates.and(multimap.entryPredicate(),
Maps.valuePredicateOnEntries(Predicates.not(Predicates.in(c)))));
}
@Override

View File

@ -252,7 +252,7 @@ public abstract class FluentIterable<E> implements Iterable<E> {
*/
public final Optional<E> first() {
Iterator<E> iterator = iterable.iterator();
return iterator.hasNext() ? Optional.of(iterator.next()) : Optional.<E>absent();
return iterator.hasNext() ? Optional.of(iterator.next()) : Optional.absent();
}
/**

View File

@ -251,10 +251,9 @@ final class GeneralRange<T> implements Serializable {
@Override
public String toString() {
return new StringBuilder().append(comparator).append(":").append(lowerBoundType == CLOSED ? '[' : '(')
.append(hasLowerBound ? lowerEndpoint : "-\u221e").append(',')
.append(hasUpperBound ? upperEndpoint : "\u221e").append(upperBoundType == CLOSED ? ']' : ')')
.toString();
return comparator + ":" + (lowerBoundType == CLOSED ? '[' : '(') +
(hasLowerBound ? lowerEndpoint : "-\u221e") + ',' +
(hasUpperBound ? upperEndpoint : "\u221e") + (upperBoundType == CLOSED ? ']' : ')');
}
T getLowerEndpoint() {

View File

@ -590,7 +590,7 @@ public final class HashBiMap<K, V> extends AbstractMap<K, V> implements BiMap<K,
}
class InverseEntry extends AbstractMapEntry<V, K> {
BiEntry<K, V> delegate;
final BiEntry<K, V> delegate;
InverseEntry(BiEntry<K, V> entry) {
this.delegate = entry;

View File

@ -93,13 +93,13 @@ public final class HashMultimap<K, V> extends AbstractSetMultimap<K, V> {
}
private HashMultimap(int expectedKeys, int expectedValuesPerKey) {
super(Maps.<K, Collection<V>>newHashMapWithExpectedSize(expectedKeys));
super(Maps.newHashMapWithExpectedSize(expectedKeys));
Preconditions.checkArgument(expectedValuesPerKey >= 0);
this.expectedValuesPerKey = expectedValuesPerKey;
}
private HashMultimap(Multimap<? extends K, ? extends V> multimap) {
super(Maps.<K, Collection<V>>newHashMapWithExpectedSize(multimap.keySet().size()));
super(Maps.newHashMapWithExpectedSize(multimap.keySet().size()));
putAll(multimap);
}
@ -113,7 +113,7 @@ public final class HashMultimap<K, V> extends AbstractSetMultimap<K, V> {
*/
@Override
Set<V> createCollection() {
return Sets.<V>newHashSetWithExpectedSize(expectedValuesPerKey);
return Sets.newHashSetWithExpectedSize(expectedValuesPerKey);
}
/**

View File

@ -72,7 +72,7 @@ public final class HashMultiset<E> extends AbstractMapBasedMultiset<E> {
}
private HashMultiset(int distinctElements) {
super(Maps.<E, Count>newHashMapWithExpectedSize(distinctElements));
super(Maps.newHashMapWithExpectedSize(distinctElements));
}
/**
@ -89,7 +89,7 @@ public final class HashMultiset<E> extends AbstractMapBasedMultiset<E> {
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
int distinctElements = Serialization.readCount(stream);
setBackingMap(Maps.<E, Count>newHashMapWithExpectedSize(distinctElements));
setBackingMap(Maps.newHashMapWithExpectedSize(distinctElements));
Serialization.populateMultiset(this, stream, distinctElements);
}

View File

@ -53,7 +53,7 @@ final class Hashing {
return smear((o == null) ? 0 : o.hashCode());
}
private static int MAX_TABLE_SIZE = Ints.MAX_POWER_OF_TWO;
private static final int MAX_TABLE_SIZE = Ints.MAX_POWER_OF_TWO;
static int closedTableSize(int expectedEntries, double loadFactor) {
// Get the recommended table size.

View File

@ -247,7 +247,7 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E> implements
if (elements instanceof ImmutableCollection) {
@SuppressWarnings("unchecked") // all supported methods are covariant
ImmutableList<E> list = ((ImmutableCollection<E>) elements).asList();
return list.isPartialView() ? ImmutableList.<E>asImmutableList(list.toArray()) : list;
return list.isPartialView() ? ImmutableList.asImmutableList(list.toArray()) : list;
}
return construct(elements.toArray());
}

View File

@ -279,7 +279,7 @@ public class ImmutableListMultimap<K, V> extends ImmutableMultimap<K, V> impleme
public ImmutableList<V> get(@Nullable K key) {
// This cast is safe as its type is known in constructor.
ImmutableList<V> list = (ImmutableList<V>) map.get(key);
return (list == null) ? ImmutableList.<V>of() : list;
return (list == null) ? ImmutableList.of() : list;
}
private transient ImmutableListMultimap<V, K> inverse;

View File

@ -263,7 +263,7 @@ public abstract class ImmutableMultimap<K, V> extends AbstractMultimap<K, V> imp
if (keyComparator != null) {
Multimap<K, V> sortedCopy = new BuilderMultimap<K, V>();
List<Map.Entry<K, Collection<V>>> entries = Lists.newArrayList(builderMultimap.asMap().entrySet());
Collections.sort(entries, Ordering.from(keyComparator).<K>onKeys());
Collections.sort(entries, Ordering.from(keyComparator).onKeys());
for (Map.Entry<K, Collection<V>> entry : entries) {
sortedCopy.putAll(entry.getKey(), entry.getValue());
}

View File

@ -53,7 +53,7 @@ import com.google.common.primitives.Ints;
public abstract class ImmutableMultiset<E> extends ImmutableCollection<E> implements Multiset<E> {
private static final ImmutableMultiset<Object> EMPTY = new RegularImmutableMultiset<Object>(
ImmutableMap.<Object, Integer>of(), 0);
ImmutableMap.of(), 0);
/**
* Returns the empty immutable multiset.
@ -342,7 +342,7 @@ public abstract class ImmutableMultiset<E> extends ImmutableCollection<E> implem
}
private final ImmutableSet<Entry<E>> createEntrySet() {
return isEmpty() ? ImmutableSet.<Entry<E>>of() : new EntrySet();
return isEmpty() ? ImmutableSet.of() : new EntrySet();
}
abstract Entry<E> getEntry(int index);
@ -487,7 +487,7 @@ public abstract class ImmutableMultiset<E> extends ImmutableCollection<E> implem
* generated by {@link ImmutableMultiset#builder}.
*/
public Builder() {
this(LinkedHashMultiset.<E>create());
this(LinkedHashMultiset.create());
}
Builder(Multiset<E> contents) {

View File

@ -45,7 +45,7 @@ import com.google.common.collect.SortedLists.KeyPresentBehavior;
public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K, V> {
private static final ImmutableRangeMap<Comparable<?>, Object> EMPTY = new ImmutableRangeMap<Comparable<?>, Object>(
ImmutableList.<Range<Comparable<?>>>of(), ImmutableList.of());
ImmutableList.of(), ImmutableList.of());
/**
* Returns an empty immutable range map.
@ -162,7 +162,7 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
@Override
@Nullable
public V get(K key) {
int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), Cut.belowValue(key),
int index = SortedLists.binarySearch(ranges, Range.lowerBoundFn(), Cut.belowValue(key),
KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
if (index == -1) {
return null;
@ -175,7 +175,7 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), Cut.belowValue(key),
int index = SortedLists.binarySearch(ranges, Range.lowerBoundFn(), Cut.belowValue(key),
KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
if (index == -1) {
return null;
@ -232,9 +232,9 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
} else if (ranges.isEmpty() || range.encloses(span())) {
return this;
}
int lowerIndex = SortedLists.binarySearch(ranges, Range.<K>upperBoundFn(), range.lowerBound,
int lowerIndex = SortedLists.binarySearch(ranges, Range.upperBoundFn(), range.lowerBound,
KeyPresentBehavior.FIRST_AFTER, KeyAbsentBehavior.NEXT_HIGHER);
int upperIndex = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), range.upperBound,
int upperIndex = SortedLists.binarySearch(ranges, Range.lowerBoundFn(), range.upperBound,
KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_HIGHER);
if (lowerIndex >= upperIndex) {
return ImmutableRangeMap.of();

View File

@ -43,10 +43,10 @@ import com.google.common.primitives.Ints;
public final class ImmutableRangeSet<C extends Comparable> extends AbstractRangeSet<C> implements Serializable {
private static final ImmutableRangeSet<Comparable<?>> EMPTY = new ImmutableRangeSet<Comparable<?>>(
ImmutableList.<Range<Comparable<?>>>of());
ImmutableList.of());
private static final ImmutableRangeSet<Comparable<?>> ALL = new ImmutableRangeSet<Comparable<?>>(
ImmutableList.of(Range.<Comparable<?>>all()));
ImmutableList.of(Range.all()));
/**
* Returns an empty immutable range set.
@ -88,7 +88,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
checkNotNull(rangeSet);
if (rangeSet.isEmpty()) {
return of();
} else if (rangeSet.encloses(Range.<C>all())) {
} else if (rangeSet.encloses(Range.all())) {
return all();
}
@ -114,14 +114,14 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
@Override
public boolean encloses(Range<C> otherRange) {
int index = SortedLists.binarySearch(ranges, Range.<C>lowerBoundFn(), otherRange.lowerBound, Ordering.natural(),
int index = SortedLists.binarySearch(ranges, Range.lowerBoundFn(), otherRange.lowerBound, Ordering.natural(),
ANY_PRESENT, NEXT_LOWER);
return index != -1 && ranges.get(index).encloses(otherRange);
}
@Override
public Range<C> rangeContaining(C value) {
int index = SortedLists.binarySearch(ranges, Range.<C>lowerBoundFn(), Cut.belowValue(value), Ordering.natural(),
int index = SortedLists.binarySearch(ranges, Range.lowerBoundFn(), Cut.belowValue(value), Ordering.natural(),
ANY_PRESENT, NEXT_LOWER);
if (index != -1) {
Range<C> range = ranges.get(index);
@ -207,14 +207,14 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
Cut<C> lowerBound;
if (positiveBoundedBelow) {
lowerBound = (index == 0) ? Cut.<C>belowAll() : ranges.get(index - 1).upperBound;
lowerBound = (index == 0) ? Cut.belowAll() : ranges.get(index - 1).upperBound;
} else {
lowerBound = ranges.get(index).upperBound;
}
Cut<C> upperBound;
if (positiveBoundedAbove && index == size - 1) {
upperBound = Cut.<C>aboveAll();
upperBound = Cut.aboveAll();
} else {
upperBound = ranges.get(index + (positiveBoundedBelow ? 0 : 1)).lowerBound;
}
@ -257,7 +257,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
final int fromIndex;
if (range.hasLowerBound()) {
fromIndex = SortedLists.binarySearch(ranges, Range.<C>upperBoundFn(), range.lowerBound,
fromIndex = SortedLists.binarySearch(ranges, Range.upperBoundFn(), range.lowerBound,
KeyPresentBehavior.FIRST_AFTER, KeyAbsentBehavior.NEXT_HIGHER);
} else {
fromIndex = 0;
@ -265,7 +265,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
int toIndex;
if (range.hasUpperBound()) {
toIndex = SortedLists.binarySearch(ranges, Range.<C>lowerBoundFn(), range.upperBound,
toIndex = SortedLists.binarySearch(ranges, Range.lowerBoundFn(), range.upperBound,
KeyPresentBehavior.FIRST_PRESENT, KeyAbsentBehavior.NEXT_HIGHER);
} else {
toIndex = ranges.size();

View File

@ -271,7 +271,7 @@ public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V> implemen
if (keyComparator != null) {
Multimap<K, V> sortedCopy = new BuilderMultimap<K, V>();
List<Map.Entry<K, Collection<V>>> entries = Lists.newArrayList(builderMultimap.asMap().entrySet());
Collections.sort(entries, Ordering.from(keyComparator).<K>onKeys());
Collections.sort(entries, Ordering.from(keyComparator).onKeys());
for (Map.Entry<K, Collection<V>> entry : entries) {
sortedCopy.putAll(entry.getKey(), entry.getValue());
}
@ -459,7 +459,7 @@ public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V> implemen
}
private static <V> ImmutableSet<V> emptySet(@Nullable Comparator<? super V> valueComparator) {
return (valueComparator == null) ? ImmutableSet.<V>of() : ImmutableSortedSet.<V>emptySet(valueComparator);
return (valueComparator == null) ? ImmutableSet.of() : ImmutableSortedSet.emptySet(valueComparator);
}
/**

View File

@ -196,7 +196,7 @@ public abstract class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxver
// Hack around K not being a subtype of Comparable.
// Unsafe, see ImmutableSortedSetFauxverideShim.
@SuppressWarnings("unchecked")
Ordering<K> naturalOrder = (Ordering<K>) Ordering.<Comparable>natural();
Ordering<K> naturalOrder = (Ordering<K>) Ordering.natural();
return copyOfInternal(map, naturalOrder);
}
@ -283,7 +283,7 @@ public abstract class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxver
}
private static <K, V> void sortEntries(final Comparator<? super K> comparator, int size, Entry<K, V>[] entries) {
Arrays.sort(entries, 0, size, Ordering.from(comparator).<K>onKeys());
Arrays.sort(entries, 0, size, Ordering.from(comparator).onKeys());
}
private static <K, V> void validateEntries(int size, Entry<K, V>[] entries, Comparator<? super K> comparator) {

View File

@ -221,7 +221,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableSortedMultiset
// Hack around E not being a subtype of Comparable.
// Unsafe, see ImmutableSortedMultisetFauxverideShim.
@SuppressWarnings("unchecked")
Ordering<E> naturalOrder = (Ordering<E>) Ordering.<Comparable>natural();
Ordering<E> naturalOrder = (Ordering<E>) Ordering.natural();
return copyOf(naturalOrder, elements);
}
@ -240,7 +240,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableSortedMultiset
// Hack around E not being a subtype of Comparable.
// Unsafe, see ImmutableSortedMultisetFauxverideShim.
@SuppressWarnings("unchecked")
Ordering<E> naturalOrder = (Ordering<E>) Ordering.<Comparable>natural();
Ordering<E> naturalOrder = (Ordering<E>) Ordering.natural();
return copyOf(naturalOrder, elements);
}
@ -480,7 +480,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableSortedMultiset
* generated by {@link ImmutableSortedMultiset#orderedBy(Comparator)}.
*/
public Builder(Comparator<? super E> comparator) {
super(TreeMultiset.<E>create(checkNotNull(comparator)));
super(TreeMultiset.create(checkNotNull(comparator)));
}
/**

View File

@ -257,7 +257,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
// Hack around E not being a subtype of Comparable.
// Unsafe, see ImmutableSortedSetFauxverideShim.
@SuppressWarnings("unchecked")
Ordering<E> naturalOrder = (Ordering<E>) Ordering.<Comparable>natural();
Ordering<E> naturalOrder = (Ordering<E>) Ordering.natural();
return copyOf(naturalOrder, elements);
}
@ -297,7 +297,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
// Hack around E not being a subtype of Comparable.
// Unsafe, see ImmutableSortedSetFauxverideShim.
@SuppressWarnings("unchecked")
Ordering<E> naturalOrder = (Ordering<E>) Ordering.<Comparable>natural();
Ordering<E> naturalOrder = (Ordering<E>) Ordering.natural();
return copyOf(naturalOrder, elements);
}
@ -317,7 +317,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
// Hack around E not being a subtype of Comparable.
// Unsafe, see ImmutableSortedSetFauxverideShim.
@SuppressWarnings("unchecked")
Ordering<E> naturalOrder = (Ordering<E>) Ordering.<Comparable>natural();
Ordering<E> naturalOrder = (Ordering<E>) Ordering.natural();
return copyOf(naturalOrder, elements);
}
@ -442,7 +442,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
}
}
Arrays.fill(contents, uniques, n, null);
return new RegularImmutableSortedSet<E>(ImmutableList.<E>asImmutableList(contents, uniques), comparator);
return new RegularImmutableSortedSet<E>(ImmutableList.asImmutableList(contents, uniques), comparator);
}
/**

View File

@ -49,7 +49,7 @@ import com.google.common.base.Objects;
// TODO(gak): make serializable
public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V> {
private static final ImmutableTable<Object, Object, Object> EMPTY = new SparseImmutableTable<Object, Object, Object>(
ImmutableList.<Cell<Object, Object, Object>>of(), ImmutableSet.of(), ImmutableSet.of());
ImmutableList.of(), ImmutableSet.of(), ImmutableSet.of());
/** Returns an empty immutable table. */
@SuppressWarnings("unchecked")
@ -90,7 +90,7 @@ public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V> {
return of();
case 1:
Cell<? extends R, ? extends C, ? extends V> onlyCell = Iterables.getOnlyElement(table.cellSet());
return ImmutableTable.<R, C, V>of(onlyCell.getRowKey(), onlyCell.getColumnKey(), onlyCell.getValue());
return ImmutableTable.of(onlyCell.getRowKey(), onlyCell.getColumnKey(), onlyCell.getValue());
default:
ImmutableSet.Builder<Cell<R, C, V>> cellSetBuilder = ImmutableSet.builder();
for (Cell<? extends R, ? extends C, ? extends V> cell : table.cellSet()) {
@ -98,7 +98,7 @@ public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V> {
* Must cast to be able to create a Cell<R, C, V> rather than a Cell<? extends
* R, ? extends C, ? extends V>
*/
cellSetBuilder.add(cellOf((R) cell.getRowKey(), (C) cell.getColumnKey(), (V) cell.getValue()));
cellSetBuilder.add(cellOf(cell.getRowKey(), cell.getColumnKey(), cell.getValue()));
}
return RegularImmutableTable.forCells(cellSetBuilder.build());
}
@ -276,7 +276,7 @@ public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V> {
@Override
public ImmutableMap<R, V> column(C columnKey) {
checkNotNull(columnKey);
return Objects.firstNonNull((ImmutableMap<R, V>) columnMap().get(columnKey), ImmutableMap.<R, V>of());
return Objects.firstNonNull((ImmutableMap<R, V>) columnMap().get(columnKey), ImmutableMap.of());
}
@Override
@ -302,7 +302,7 @@ public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V> {
@Override
public ImmutableMap<C, V> row(R rowKey) {
checkNotNull(rowKey);
return Objects.firstNonNull((ImmutableMap<C, V>) rowMap().get(rowKey), ImmutableMap.<C, V>of());
return Objects.firstNonNull((ImmutableMap<C, V>) rowMap().get(rowKey), ImmutableMap.of());
}
@Override

View File

@ -389,7 +389,7 @@ public final class Iterables {
@Override
public String toString() {
return iterable.toString() + " (cycled)";
return iterable + " (cycled)";
}
};
}

View File

@ -750,7 +750,7 @@ public final class Iterators {
*/
public static <T> Optional<T> tryFind(Iterator<T> iterator, Predicate<? super T> predicate) {
UnmodifiableIterator<T> filteredIterator = filter(iterator, predicate);
return filteredIterator.hasNext() ? Optional.of(filteredIterator.next()) : Optional.<T>absent();
return filteredIterator.hasNext() ? Optional.of(filteredIterator.next()) : Optional.absent();
}
/**

View File

@ -434,7 +434,7 @@ public class LinkedListMultimap<K, V> extends AbstractMultimap<K, V> implements
/** An {@code Iterator} over distinct keys in key head order. */
private class DistinctKeyIterator implements Iterator<K> {
final Set<K> seenKeys = Sets.<K>newHashSetWithExpectedSize(keySet().size());
final Set<K> seenKeys = Sets.newHashSetWithExpectedSize(keySet().size());
Node<K, V> next = head;
Node<K, V> current;
int expectedModCount = modCount;

View File

@ -97,7 +97,7 @@ public final class Maps {
public Object apply(Entry<?, ?> entry) {
return entry.getValue();
}
};
}
}
@SuppressWarnings("unchecked")
@ -111,11 +111,11 @@ public final class Maps {
}
static <K, V> Iterator<K> keyIterator(Iterator<Entry<K, V>> entryIterator) {
return Iterators.transform(entryIterator, Maps.<K>keyFunction());
return Iterators.transform(entryIterator, Maps.keyFunction());
}
static <K, V> Iterator<V> valueIterator(Iterator<Entry<K, V>> entryIterator) {
return Iterators.transform(entryIterator, Maps.<V>valueFunction());
return Iterators.transform(entryIterator, Maps.valueFunction());
}
static <K, V> UnmodifiableIterator<V> valueIterator(final UnmodifiableIterator<Entry<K, V>> entryIterator) {
@ -1973,7 +1973,7 @@ public final class Maps {
@Override
public Iterator<Entry<K, V2>> iterator() {
return Iterators.transform(fromMap.entrySet().iterator(),
Maps.<K, V1, V2>asEntryToEntryFunction(transformer));
Maps.asEntryToEntryFunction(transformer));
}
};
}
@ -2147,11 +2147,11 @@ public final class Maps {
}
static <K> Predicate<Entry<K, ?>> keyPredicateOnEntries(Predicate<? super K> keyPredicate) {
return compose(keyPredicate, Maps.<K>keyFunction());
return compose(keyPredicate, Maps.keyFunction());
}
static <V> Predicate<Entry<?, V>> valuePredicateOnEntries(Predicate<? super V> valuePredicate) {
return compose(valuePredicate, Maps.<V>valueFunction());
return compose(valuePredicate, Maps.valueFunction());
}
/**
@ -2239,7 +2239,7 @@ public final class Maps {
final Predicate<? super K> keyPredicate) {
// TODO(user): Return a subclass of Maps.FilteredKeyMap for slightly better
// performance.
return filterEntries(unfiltered, Maps.<K>keyPredicateOnEntries(keyPredicate));
return filterEntries(unfiltered, Maps.keyPredicateOnEntries(keyPredicate));
}
/**
@ -2282,7 +2282,7 @@ public final class Maps {
final Predicate<? super K> keyPredicate) {
// TODO(user): Return a subclass of Maps.FilteredKeyMap for slightly better
// performance.
return filterEntries(unfiltered, Maps.<K>keyPredicateOnEntries(keyPredicate));
return filterEntries(unfiltered, Maps.keyPredicateOnEntries(keyPredicate));
}
/**
@ -2321,7 +2321,7 @@ public final class Maps {
*/
public static <K, V> BiMap<K, V> filterKeys(BiMap<K, V> unfiltered, final Predicate<? super K> keyPredicate) {
checkNotNull(keyPredicate);
return filterEntries(unfiltered, Maps.<K>keyPredicateOnEntries(keyPredicate));
return filterEntries(unfiltered, Maps.keyPredicateOnEntries(keyPredicate));
}
/**
@ -2364,7 +2364,7 @@ public final class Maps {
} else if (unfiltered instanceof BiMap) {
return filterValues((BiMap<K, V>) unfiltered, valuePredicate);
}
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate));
}
/**
@ -2405,7 +2405,7 @@ public final class Maps {
*/
public static <K, V> SortedMap<K, V> filterValues(SortedMap<K, V> unfiltered,
final Predicate<? super V> valuePredicate) {
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate));
}
/**
@ -2447,7 +2447,7 @@ public final class Maps {
@GwtIncompatible("NavigableMap")
public static <K, V> NavigableMap<K, V> filterValues(NavigableMap<K, V> unfiltered,
final Predicate<? super V> valuePredicate) {
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate));
}
/**
@ -2487,7 +2487,7 @@ public final class Maps {
* @since 14.0
*/
public static <K, V> BiMap<K, V> filterValues(BiMap<K, V> unfiltered, final Predicate<? super V> valuePredicate) {
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate));
}
/**
@ -2681,7 +2681,7 @@ public final class Maps {
*/
private static <K, V> Map<K, V> filterFiltered(AbstractFilteredMap<K, V> map,
Predicate<? super Entry<K, V>> entryPredicate) {
return new FilteredEntryMap<K, V>(map.unfiltered, Predicates.<Entry<K, V>>and(map.predicate, entryPredicate));
return new FilteredEntryMap<K, V>(map.unfiltered, Predicates.and(map.predicate, entryPredicate));
}
private abstract static class AbstractFilteredMap<K, V> extends ImprovedAbstractMap<K, V> {
@ -2755,12 +2755,12 @@ public final class Maps {
@Override
public boolean remove(Object o) {
return Iterables.removeFirstMatching(unfiltered.entrySet(),
Predicates.<Entry<K, V>>and(predicate, Maps.<V>valuePredicateOnEntries(equalTo(o)))) != null;
Predicates.and(predicate, Maps.valuePredicateOnEntries(equalTo(o)))) != null;
}
private boolean removeIf(Predicate<? super V> valuePredicate) {
return Iterables.removeIf(unfiltered.entrySet(),
Predicates.<Entry<K, V>>and(predicate, Maps.<V>valuePredicateOnEntries(valuePredicate)));
Predicates.and(predicate, Maps.valuePredicateOnEntries(valuePredicate)));
}
@Override
@ -2879,7 +2879,7 @@ public final class Maps {
private boolean removeIf(Predicate<? super K> keyPredicate) {
return Iterables.removeIf(unfiltered.entrySet(),
Predicates.<Entry<K, V>>and(predicate, Maps.<K>keyPredicateOnEntries(keyPredicate)));
Predicates.and(predicate, Maps.keyPredicateOnEntries(keyPredicate)));
}
@Override
@ -3047,13 +3047,13 @@ public final class Maps {
@Override
public boolean removeAll(Collection<?> c) {
return Iterators.removeIf(unfiltered.entrySet().iterator(),
Predicates.<Entry<K, V>>and(entryPredicate, Maps.<K>keyPredicateOnEntries(in(c))));
Predicates.and(entryPredicate, Maps.keyPredicateOnEntries(in(c))));
}
@Override
public boolean retainAll(Collection<?> c) {
return Iterators.removeIf(unfiltered.entrySet().iterator(),
Predicates.<Entry<K, V>>and(entryPredicate, Maps.<K>keyPredicateOnEntries(not(in(c)))));
Predicates.and(entryPredicate, Maps.keyPredicateOnEntries(not(in(c)))));
}
};
}

View File

@ -108,7 +108,7 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> {
* and initially containing the given elements.
*/
public static <E extends Comparable<E>> MinMaxPriorityQueue<E> create(Iterable<? extends E> initialContents) {
return new Builder<E>(Ordering.<E>natural()).create(initialContents);
return new Builder<E>(Ordering.natural()).create(initialContents);
}
/**
@ -196,7 +196,7 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> {
* and having no initial contents.
*/
public <T extends B> MinMaxPriorityQueue<T> create() {
return create(Collections.<T>emptySet());
return create(Collections.emptySet());
}
/**
@ -715,10 +715,7 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> {
if ((i > 0) && (compareElements(i, getParentIndex(i)) > 0)) {
return false;
}
if ((i > 2) && (compareElements(getGrandparentIndex(i), i) > 0)) {
return false;
}
return true;
return (i <= 2) || (compareElements(getGrandparentIndex(i), i) <= 0);
}
// These would be static if inner classes could have static members.

View File

@ -324,7 +324,7 @@ public abstract class MultimapBuilder<K0, V0> {
return new ListMultimapBuilder<K0, Object>() {
@Override
public <K extends K0, V> ListMultimap<K, V> build() {
return Multimaps.newListMultimap(MultimapBuilderWithKeys.this.<K, V>createMap(),
return Multimaps.newListMultimap(MultimapBuilderWithKeys.this.createMap(),
new ArrayListSupplier<V>(expectedValuesPerKey));
}
};
@ -337,8 +337,8 @@ public abstract class MultimapBuilder<K0, V0> {
return new ListMultimapBuilder<K0, Object>() {
@Override
public <K extends K0, V> ListMultimap<K, V> build() {
return Multimaps.newListMultimap(MultimapBuilderWithKeys.this.<K, V>createMap(),
LinkedListSupplier.<V>instance());
return Multimaps.newListMultimap(MultimapBuilderWithKeys.this.createMap(),
LinkedListSupplier.instance());
}
};
}
@ -361,7 +361,7 @@ public abstract class MultimapBuilder<K0, V0> {
return new SetMultimapBuilder<K0, Object>() {
@Override
public <K extends K0, V> SetMultimap<K, V> build() {
return Multimaps.newSetMultimap(MultimapBuilderWithKeys.this.<K, V>createMap(),
return Multimaps.newSetMultimap(MultimapBuilderWithKeys.this.createMap(),
new HashSetSupplier<V>(expectedValuesPerKey));
}
};
@ -385,7 +385,7 @@ public abstract class MultimapBuilder<K0, V0> {
return new SetMultimapBuilder<K0, Object>() {
@Override
public <K extends K0, V> SetMultimap<K, V> build() {
return Multimaps.newSetMultimap(MultimapBuilderWithKeys.this.<K, V>createMap(),
return Multimaps.newSetMultimap(MultimapBuilderWithKeys.this.createMap(),
new LinkedHashSetSupplier<V>(expectedValuesPerKey));
}
};
@ -412,7 +412,7 @@ public abstract class MultimapBuilder<K0, V0> {
return new SortedSetMultimapBuilder<K0, V0>() {
@Override
public <K extends K0, V extends V0> SortedSetMultimap<K, V> build() {
return Multimaps.newSortedSetMultimap(MultimapBuilderWithKeys.this.<K, V>createMap(),
return Multimaps.newSortedSetMultimap(MultimapBuilderWithKeys.this.createMap(),
new TreeSetSupplier<V>(comparator));
}
};
@ -430,7 +430,7 @@ public abstract class MultimapBuilder<K0, V0> {
// (their subclasses are inaccessible)
@SuppressWarnings({ "unchecked", "rawtypes" })
Supplier<Set<V>> factory = (Supplier) new EnumSetSupplier<V0>(valueClass);
return Multimaps.newSetMultimap(MultimapBuilderWithKeys.this.<K, V>createMap(), factory);
return Multimaps.newSetMultimap(MultimapBuilderWithKeys.this.createMap(), factory);
}
};
}

View File

@ -1277,7 +1277,7 @@ public final class Multimaps {
@Override
Iterator<Entry<K, V2>> entryIterator() {
return Iterators.transform(fromMultimap.entries().iterator(),
Maps.<K, V1, V2>asEntryToEntryFunction(transformer));
Maps.asEntryToEntryFunction(transformer));
}
@Override
@ -1339,7 +1339,7 @@ public final class Multimaps {
@Override
Collection<V2> createValues() {
return Collections2.transform(fromMultimap.entries(), Maps.<K, V1, V2>asEntryToValueFunction(transformer));
return Collections2.transform(fromMultimap.entries(), Maps.asEntryToValueFunction(transformer));
}
}
@ -1917,7 +1917,7 @@ public final class Multimaps {
return new FilteredKeyMultimap<K, V>(prev.unfiltered, Predicates.and(prev.keyPredicate, keyPredicate));
} else if (unfiltered instanceof FilteredMultimap) {
FilteredMultimap<K, V> prev = (FilteredMultimap<K, V>) unfiltered;
return filterFiltered(prev, Maps.<K>keyPredicateOnEntries(keyPredicate));
return filterFiltered(prev, Maps.keyPredicateOnEntries(keyPredicate));
} else {
return new FilteredKeyMultimap<K, V>(unfiltered, keyPredicate);
}
@ -1965,7 +1965,7 @@ public final class Multimaps {
return new FilteredKeySetMultimap<K, V>(prev.unfiltered(), Predicates.and(prev.keyPredicate, keyPredicate));
} else if (unfiltered instanceof FilteredSetMultimap) {
FilteredSetMultimap<K, V> prev = (FilteredSetMultimap<K, V>) unfiltered;
return filterFiltered(prev, Maps.<K>keyPredicateOnEntries(keyPredicate));
return filterFiltered(prev, Maps.keyPredicateOnEntries(keyPredicate));
} else {
return new FilteredKeySetMultimap<K, V>(unfiltered, keyPredicate);
}
@ -2054,7 +2054,7 @@ public final class Multimaps {
*/
public static <K, V> Multimap<K, V> filterValues(Multimap<K, V> unfiltered,
final Predicate<? super V> valuePredicate) {
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate));
}
/**
@ -2094,7 +2094,7 @@ public final class Multimaps {
*/
public static <K, V> SetMultimap<K, V> filterValues(SetMultimap<K, V> unfiltered,
final Predicate<? super V> valuePredicate) {
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate));
}
/**

View File

@ -110,7 +110,7 @@ public final class Multisets {
transient Set<E> elementSet;
Set<E> createElementSet() {
return Collections.<E>unmodifiableSet(delegate.elementSet());
return Collections.unmodifiableSet(delegate.elementSet());
}
@Override
@ -290,7 +290,7 @@ public final class Multisets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredMultiset<E> filtered = (FilteredMultiset<E>) unfiltered;
Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
return new FilteredMultiset<E>(filtered.unfiltered, combinedPredicate);
}
return new FilteredMultiset<E>(unfiltered, predicate);

View File

@ -314,7 +314,7 @@ public abstract class Ordering<T> implements Comparator<T> {
}
<T2 extends T> Ordering<Map.Entry<T2, ?>> onKeys() {
return onResultOf(Maps.<T2>keyFunction());
return onResultOf(Maps.keyFunction());
}
/**

View File

@ -268,7 +268,7 @@ public final class Range<C extends Comparable> implements Predicate<C>, Serializ
* @since 14.0
*/
public static <C extends Comparable<?>> Range<C> lessThan(C endpoint) {
return create(Cut.<C>belowAll(), Cut.belowValue(endpoint));
return create(Cut.belowAll(), Cut.belowValue(endpoint));
}
/**
@ -278,7 +278,7 @@ public final class Range<C extends Comparable> implements Predicate<C>, Serializ
* @since 14.0
*/
public static <C extends Comparable<?>> Range<C> atMost(C endpoint) {
return create(Cut.<C>belowAll(), Cut.aboveValue(endpoint));
return create(Cut.belowAll(), Cut.aboveValue(endpoint));
}
/**
@ -305,7 +305,7 @@ public final class Range<C extends Comparable> implements Predicate<C>, Serializ
* @since 14.0
*/
public static <C extends Comparable<?>> Range<C> greaterThan(C endpoint) {
return create(Cut.aboveValue(endpoint), Cut.<C>aboveAll());
return create(Cut.aboveValue(endpoint), Cut.aboveAll());
}
/**
@ -315,7 +315,7 @@ public final class Range<C extends Comparable> implements Predicate<C>, Serializ
* @since 14.0
*/
public static <C extends Comparable<?>> Range<C> atLeast(C endpoint) {
return create(Cut.belowValue(endpoint), Cut.<C>aboveAll());
return create(Cut.belowValue(endpoint), Cut.aboveAll());
}
/**

View File

@ -37,7 +37,7 @@ class RegularImmutableAsList<E> extends ImmutableAsList<E> {
}
RegularImmutableAsList(ImmutableCollection<E> delegate, Object[] array) {
this(delegate, ImmutableList.<E>asImmutableList(array));
this(delegate, ImmutableList.asImmutableList(array));
}
@Override

View File

@ -39,7 +39,7 @@ abstract class RegularImmutableTable<R, C, V> extends ImmutableTable<R, C, V> {
@Override
final ImmutableSet<Cell<R, C, V>> createCellSet() {
return isEmpty() ? ImmutableSet.<Cell<R, C, V>>of() : new CellSet();
return isEmpty() ? ImmutableSet.of() : new CellSet();
}
private final class CellSet extends ImmutableSet<Cell<R, C, V>> {
@ -88,7 +88,7 @@ abstract class RegularImmutableTable<R, C, V> extends ImmutableTable<R, C, V> {
@Override
final ImmutableCollection<V> createValues() {
return isEmpty() ? ImmutableList.<V>of() : new Values();
return isEmpty() ? ImmutableList.of() : new Values();
}
private final class Values extends ImmutableList<V> {

View File

@ -365,7 +365,7 @@ public final class Sets {
* @since 8.0
*/
public static <E> Set<E> newIdentityHashSet() {
return Sets.newSetFromMap(Maps.<E, Boolean>newIdentityHashMap());
return Sets.newSetFromMap(Maps.newIdentityHashMap());
}
/**
@ -732,7 +732,7 @@ public final class Sets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredSet<E> filtered = (FilteredSet<E>) unfiltered;
Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
return new FilteredSet<E>((Set<E>) filtered.unfiltered, combinedPredicate);
}
@ -796,7 +796,7 @@ public final class Sets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredSet<E> filtered = (FilteredSet<E>) unfiltered;
Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
return new FilteredSortedSet<E>((SortedSet<E>) filtered.unfiltered, combinedPredicate);
}
@ -886,7 +886,7 @@ public final class Sets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredSet<E> filtered = (FilteredSet<E>) unfiltered;
Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
return new FilteredNavigableSet<E>((NavigableSet<E>) filtered.unfiltered, combinedPredicate);
}

View File

@ -69,7 +69,7 @@ final class SingletonImmutableList<E> extends ImmutableList<E> {
@Override
public ImmutableList<E> subList(int fromIndex, int toIndex) {
Preconditions.checkPositionIndexes(fromIndex, toIndex, 1);
return (fromIndex == toIndex) ? ImmutableList.<E>of() : this;
return (fromIndex == toIndex) ? ImmutableList.of() : this;
}
@Override
@ -104,8 +104,7 @@ final class SingletonImmutableList<E> extends ImmutableList<E> {
@Override
public String toString() {
String elementToString = element.toString();
return new StringBuilder(elementToString.length() + 2).append('[').append(elementToString).append(']')
.toString();
return '[' + elementToString + ']';
}
@Override

View File

@ -97,7 +97,7 @@ final class SingletonImmutableSet<E> extends ImmutableSet<E> {
}
@Override
public final int hashCode() {
public int hashCode() {
// Racy single-check.
int code = cachedHashCode;
if (code == 0) {
@ -114,7 +114,6 @@ final class SingletonImmutableSet<E> extends ImmutableSet<E> {
@Override
public String toString() {
String elementToString = element.toString();
return new StringBuilder(elementToString.length() + 2).append('[').append(elementToString).append(']')
.toString();
return '[' + elementToString + ']';
}
}

View File

@ -46,17 +46,17 @@ class SingletonImmutableTable<R, C, V> extends ImmutableTable<R, C, V> {
@Override
public ImmutableMap<R, V> column(C columnKey) {
checkNotNull(columnKey);
return containsColumn(columnKey) ? ImmutableMap.of(singleRowKey, singleValue) : ImmutableMap.<R, V>of();
return containsColumn(columnKey) ? ImmutableMap.of(singleRowKey, singleValue) : ImmutableMap.of();
}
@Override
public ImmutableMap<C, Map<R, V>> columnMap() {
return ImmutableMap.of(singleColumnKey, (Map<R, V>) ImmutableMap.of(singleRowKey, singleValue));
return ImmutableMap.of(singleColumnKey, ImmutableMap.of(singleRowKey, singleValue));
}
@Override
public ImmutableMap<R, Map<C, V>> rowMap() {
return ImmutableMap.of(singleRowKey, (Map<C, V>) ImmutableMap.of(singleColumnKey, singleValue));
return ImmutableMap.of(singleRowKey, ImmutableMap.of(singleColumnKey, singleValue));
}
@Override

View File

@ -569,7 +569,7 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
@Override
public boolean retainAll(final Collection<?> c) {
return removeFromColumnIf(Maps.<R>keyPredicateOnEntries(not(in(c))));
return removeFromColumnIf(Maps.keyPredicateOnEntries(not(in(c))));
}
}
@ -585,17 +585,17 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
@Override
public boolean remove(Object obj) {
return obj != null && removeFromColumnIf(Maps.<V>valuePredicateOnEntries(equalTo(obj)));
return obj != null && removeFromColumnIf(Maps.valuePredicateOnEntries(equalTo(obj)));
}
@Override
public boolean removeAll(final Collection<?> c) {
return removeFromColumnIf(Maps.<V>valuePredicateOnEntries(in(c)));
return removeFromColumnIf(Maps.valuePredicateOnEntries(in(c)));
}
@Override
public boolean retainAll(final Collection<?> c) {
return removeFromColumnIf(Maps.<V>valuePredicateOnEntries(not(in(c))));
return removeFromColumnIf(Maps.valuePredicateOnEntries(not(in(c))));
}
}
}

View File

@ -499,7 +499,7 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
@Override
public boolean retainAll(Collection<?> c) {
return removeEntryIf(compose(not(in(c)), Maps.<Range<K>>keyFunction()));
return removeEntryIf(compose(not(in(c)), Maps.keyFunction()));
}
};
}
@ -562,12 +562,12 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
return new Maps.Values<Range<K>, V>(this) {
@Override
public boolean removeAll(Collection<?> c) {
return removeEntryIf(compose(in(c), Maps.<V>valueFunction()));
return removeEntryIf(compose(in(c), Maps.valueFunction()));
}
@Override
public boolean retainAll(Collection<?> c) {
return removeEntryIf(compose(not(in(c)), Maps.<V>valueFunction()));
return removeEntryIf(compose(not(in(c)), Maps.valueFunction()));
}
};
}

View File

@ -278,7 +278,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> {
@Override
public Comparator<? super Cut<C>> comparator() {
return Ordering.<Cut<C>>natural();
return Ordering.natural();
}
@Override
@ -395,7 +395,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> {
private final Range<Cut<C>> complementLowerBoundWindow;
ComplementRangesByLowerBound(NavigableMap<Cut<C>, Range<C>> positiveRangesByLowerBound) {
this(positiveRangesByLowerBound, Range.<Cut<C>>all());
this(positiveRangesByLowerBound, Range.all());
}
private ComplementRangesByLowerBound(NavigableMap<Cut<C>, Range<C>> positiveRangesByLowerBound,
@ -433,7 +433,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> {
@Override
public Comparator<? super Cut<C>> comparator() {
return Ordering.<Cut<C>>natural();
return Ordering.natural();
}
@Override
@ -456,7 +456,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> {
}
final PeekingIterator<Range<C>> positiveItr = Iterators.peekingIterator(positiveRanges.iterator());
final Cut<C> firstComplementRangeLowerBound;
if (complementLowerBoundWindow.contains(Cut.<C>belowAll())
if (complementLowerBoundWindow.contains(Cut.belowAll())
&& (!positiveItr.hasNext() || positiveItr.peek().lowerBound != Cut.<C>belowAll())) {
firstComplementRangeLowerBound = Cut.belowAll();
} else if (positiveItr.hasNext()) {
@ -479,7 +479,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> {
negativeRange = Range.create(nextComplementRangeLowerBound, positiveRange.lowerBound);
nextComplementRangeLowerBound = positiveRange.upperBound;
} else {
negativeRange = Range.create(nextComplementRangeLowerBound, Cut.<C>aboveAll());
negativeRange = Range.create(nextComplementRangeLowerBound, Cut.aboveAll());
nextComplementRangeLowerBound = Cut.aboveAll();
}
return Maps.immutableEntry(negativeRange.lowerBound, negativeRange);
@ -500,7 +500,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> {
*/
Cut<C> startingPoint = complementLowerBoundWindow.hasUpperBound()
? complementLowerBoundWindow.upperEndpoint()
: Cut.<C>aboveAll();
: Cut.aboveAll();
boolean inclusive = complementLowerBoundWindow.hasUpperBound()
&& complementLowerBoundWindow.upperBoundType() == BoundType.CLOSED;
final PeekingIterator<Range<C>> positiveItr = Iterators.peekingIterator(
@ -509,13 +509,13 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> {
if (positiveItr.hasNext()) {
cut = (positiveItr.peek().upperBound == Cut.<C>aboveAll()) ? positiveItr.next().lowerBound
: positiveRangesByLowerBound.higherKey(positiveItr.peek().upperBound);
} else if (!complementLowerBoundWindow.contains(Cut.<C>belowAll())
} else if (!complementLowerBoundWindow.contains(Cut.belowAll())
|| positiveRangesByLowerBound.containsKey(Cut.belowAll())) {
return Iterators.emptyIterator();
} else {
cut = positiveRangesByLowerBound.higherKey(Cut.<C>belowAll());
cut = positiveRangesByLowerBound.higherKey(Cut.belowAll());
}
final Cut<C> firstComplementRangeUpperBound = Objects.firstNonNull(cut, Cut.<C>aboveAll());
final Cut<C> firstComplementRangeUpperBound = Objects.firstNonNull(cut, Cut.aboveAll());
return new AbstractIterator<Entry<Cut<C>, Range<C>>>() {
Cut<C> nextComplementRangeUpperBound = firstComplementRangeUpperBound;
@ -530,10 +530,10 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> {
if (complementLowerBoundWindow.lowerBound.isLessThan(negativeRange.lowerBound)) {
return Maps.immutableEntry(negativeRange.lowerBound, negativeRange);
}
} else if (complementLowerBoundWindow.lowerBound.isLessThan(Cut.<C>belowAll())) {
Range<C> negativeRange = Range.create(Cut.<C>belowAll(), nextComplementRangeUpperBound);
} else if (complementLowerBoundWindow.lowerBound.isLessThan(Cut.belowAll())) {
Range<C> negativeRange = Range.create(Cut.belowAll(), nextComplementRangeUpperBound);
nextComplementRangeUpperBound = Cut.belowAll();
return Maps.immutableEntry(Cut.<C>belowAll(), negativeRange);
return Maps.immutableEntry(Cut.belowAll(), negativeRange);
}
return endOfData();
}
@ -649,7 +649,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> {
@Override
public Comparator<? super Cut<C>> comparator() {
return Ordering.<Cut<C>>natural();
return Ordering.natural();
}
@Override
@ -768,7 +768,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> {
private final Range<C> restriction;
SubRangeSet(Range<C> restriction) {
super(new SubRangeSetRangesByLowerBound<C>(Range.<Cut<C>>all(), restriction,
super(new SubRangeSetRangesByLowerBound<C>(Range.all(), restriction,
TreeRangeSet.this.rangesByLowerBound));
this.restriction = restriction;
}

View File

@ -263,16 +263,12 @@ public final class Escapers {
char[] output = new char[hiCount + loCount];
if (hiChars != null) {
// TODO: Is this faster than System.arraycopy() for small arrays?
for (int n = 0; n < hiChars.length; ++n) {
output[n] = hiChars[n];
}
System.arraycopy(hiChars, 0, output, 0, hiChars.length);
} else {
output[0] = surrogateChars[0];
}
if (loChars != null) {
for (int n = 0; n < loChars.length; ++n) {
output[hiCount + n] = loChars[n];
}
System.arraycopy(loChars, 0, output, hiCount + 0, loChars.length);
} else {
output[hiCount] = surrogateChars[1];
}

View File

@ -133,7 +133,7 @@ final class Murmur3_128HashFunction extends AbstractStreamingHashFunction implem
case 10:
k2 ^= (long) toInt(bb.get(9)) << 8; // fall through
case 9:
k2 ^= (long) toInt(bb.get(8)); // fall through
k2 ^= toInt(bb.get(8)); // fall through
case 8:
k1 ^= bb.getLong();
break;
@ -150,7 +150,7 @@ final class Murmur3_128HashFunction extends AbstractStreamingHashFunction implem
case 2:
k1 ^= (long) toInt(bb.get(1)) << 8; // fall through
case 1:
k1 ^= (long) toInt(bb.get(0));
k1 ^= toInt(bb.get(0));
break;
default:
throw new AssertionError("Should never get here.");

View File

@ -16,14 +16,13 @@
package com.google.common.io;
import static com.google.common.base.Preconditions.checkNotNull;
import javax.annotation.Nullable;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import java.io.Writer;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Writer that places all output on an {@link Appendable} target. If the target
@ -52,7 +51,7 @@ class AppendableWriter extends Writer {
*/
@Override
public void write(char cbuf[], int off, int len) throws IOException {
public void write(char[] cbuf, int off, int len) throws IOException {
checkNotClosed();
// It turns out that creating a new String is usually as fast, or faster
// than wrapping cbuf in a light-weight CharSequence.

View File

@ -35,10 +35,10 @@ import java.io.IOException;
*/
public interface ByteArrayDataInput extends DataInput {
@Override
void readFully(byte b[]);
void readFully(byte[] b);
@Override
void readFully(byte b[], int off, int len);
void readFully(byte[] b, int off, int len);
@Override
int skipBytes(int n);

View File

@ -31,10 +31,10 @@ public interface ByteArrayDataOutput extends DataOutput {
void write(int b);
@Override
void write(byte b[]);
void write(byte[] b);
@Override
void write(byte b[], int off, int len);
void write(byte[] b, int off, int len);
@Override
void writeBoolean(boolean v);

View File

@ -16,16 +16,11 @@
package com.google.common.io;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.io.*;
import java.nio.charset.Charset;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* A destination to which bytes can be written, such as a file. Unlike an
* {@link OutputStream}, a {@code ByteSink} is not an open, stateful stream that
@ -174,7 +169,7 @@ public abstract class ByteSink implements OutputSupplier<OutputStream> {
@Override
public String toString() {
return ByteSink.this.toString() + ".asCharSink(" + charset + ")";
return ByteSink.this + ".asCharSink(" + charset + ")";
}
}
}

View File

@ -16,19 +16,6 @@
package com.google.common.io;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Iterator;
import com.google.common.annotations.Beta;
import com.google.common.base.Ascii;
import com.google.common.collect.ImmutableList;
@ -36,9 +23,16 @@ import com.google.common.hash.Funnels;
import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hasher;
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
import java.io.*;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Iterator;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* A readable source of bytes, such as a file. Unlike an {@link InputStream}, a
* {@code ByteSource} is not an open, stateful stream for input that can be read
@ -464,7 +458,7 @@ public abstract class ByteSource implements InputSupplier<InputStream> {
@Override
public String toString() {
return ByteSource.this.toString() + ".asCharSource(" + charset + ")";
return ByteSource.this + ".asCharSource(" + charset + ")";
}
}
@ -525,7 +519,7 @@ public abstract class ByteSource implements InputSupplier<InputStream> {
@Override
public String toString() {
return ByteSource.this.toString() + ".slice(" + offset + ", " + length + ")";
return ByteSource.this + ".slice(" + offset + ", " + length + ")";
}
}

View File

@ -16,33 +16,21 @@
package com.google.common.io;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkPositionIndex;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.util.Arrays;
import com.google.common.annotations.Beta;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.util.Arrays;
import static com.google.common.base.Preconditions.*;
/**
* Provides utility methods for working with byte arrays and I/O streams.
*
@ -320,7 +308,7 @@ public final class ByteStreams {
}
@Override
public void readFully(byte b[]) {
public void readFully(byte[] b) {
try {
input.readFully(b);
} catch (IOException e) {
@ -329,7 +317,7 @@ public final class ByteStreams {
}
@Override
public void readFully(byte b[], int off, int len) {
public void readFully(byte[] b, int off, int len) {
try {
input.readFully(b, off, len);
} catch (IOException e) {

View File

@ -16,8 +16,14 @@
package com.google.common.io;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.Beta;
import com.google.common.base.Ascii;
import com.google.common.base.Splitter;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import javax.annotation.Nullable;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
@ -27,14 +33,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.common.base.Ascii;
import com.google.common.base.Splitter;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* A readable source of characters, such as a text file. Unlike a
@ -403,7 +402,7 @@ public abstract class CharSource implements InputSupplier<Reader> {
@Override
public Iterator<String> iterator() {
return new AbstractIterator<String>() {
Iterator<String> lines = LINE_SPLITTER.split(seq).iterator();
final Iterator<String> lines = LINE_SPLITTER.split(seq).iterator();
@Override
protected String computeNext() {

View File

@ -33,7 +33,7 @@ import javax.annotation.Nullable;
*/
final class MultiInputStream extends InputStream {
private Iterator<? extends ByteSource> it;
private final Iterator<? extends ByteSource> it;
private InputStream in;
/**

View File

@ -50,7 +50,7 @@ class MultiReader extends Reader {
}
@Override
public int read(@Nullable char cbuf[], int off, int len) throws IOException {
public int read(@Nullable char[] cbuf, int off, int len) throws IOException {
if (current == null) {
return -1;
}

View File

@ -537,10 +537,10 @@ public final class IntMath {
return (n < factorials.length) ? factorials[n] : Integer.MAX_VALUE;
}
private static final int[] factorials = { 1, 1, 1 * 2, 1 * 2 * 3, 1 * 2 * 3 * 4, 1 * 2 * 3 * 4 * 5,
1 * 2 * 3 * 4 * 5 * 6, 1 * 2 * 3 * 4 * 5 * 6 * 7, 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8,
1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9, 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10,
1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11, 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 };
private static final int[] factorials = {1, 1, 2, 2 * 3, 2 * 3 * 4, 2 * 3 * 4 * 5,
2 * 3 * 4 * 5 * 6, 2 * 3 * 4 * 5 * 6 * 7, 2 * 3 * 4 * 5 * 6 * 7 * 8,
2 * 3 * 4 * 5 * 6 * 7 * 8 * 9, 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10,
2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11, 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12};
/**
* Returns {@code n} choose {@code k}, also known as the binomial coefficient of

View File

@ -615,18 +615,18 @@ public final class LongMath {
return (n < factorials.length) ? factorials[n] : Long.MAX_VALUE;
}
static final long[] factorials = { 1L, 1L, 1L * 2, 1L * 2 * 3, 1L * 2 * 3 * 4, 1L * 2 * 3 * 4 * 5,
1L * 2 * 3 * 4 * 5 * 6, 1L * 2 * 3 * 4 * 5 * 6 * 7, 1L * 2 * 3 * 4 * 5 * 6 * 7 * 8,
1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9, 1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10,
1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11, 1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12,
1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13,
1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14,
1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15,
1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16,
1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17,
1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17 * 18,
1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17 * 18 * 19,
1L * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17 * 18 * 19 * 20 };
static final long[] factorials = {1L, 1L, (long) 2, (long) 2 * 3, (long) 2 * 3 * 4, (long) 2 * 3 * 4 * 5,
(long) 2 * 3 * 4 * 5 * 6, (long) 2 * 3 * 4 * 5 * 6 * 7, (long) 2 * 3 * 4 * 5 * 6 * 7 * 8,
(long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9, (long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10,
(long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11, (long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12,
(long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13,
(long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14,
(long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15,
(long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16,
(long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17,
(long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17 * 18,
(long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17 * 18 * 19,
(long) 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17 * 18 * 19 * 20};
/**
* Returns {@code n} choose {@code k}, also known as the binomial coefficient of

View File

@ -35,7 +35,7 @@ enum PublicSuffixType {
/** The character used for a leaf node in the trie encoding */
private final char leafNodeCode;
private PublicSuffixType(char innerNodeCode, char leafNodeCode) {
PublicSuffixType(char innerNodeCode, char leafNodeCode) {
this.innerNodeCode = innerNodeCode;
this.leafNodeCode = leafNodeCode;
}

View File

@ -40,7 +40,7 @@ class TrieParser {
int encodedLen = encoded.length();
int idx = 0;
while (idx < encodedLen) {
idx += doParseTrieToBuilder(Lists.<CharSequence>newLinkedList(), encoded.subSequence(idx, encodedLen),
idx += doParseTrieToBuilder(Lists.newLinkedList(), encoded.subSequence(idx, encodedLen),
builder);
}
return builder.build();

View File

@ -1,13 +0,0 @@
package dev.resent.event.impl;
import net.minecraft.network.play.server.S19PacketEntityStatus;
public class EntityStatusEvent extends Event{
public byte status;
public EntityStatusEvent(S19PacketEntityStatus event){
this.status = event.logicOpcode;
}
}

View File

@ -1,13 +0,0 @@
package dev.resent.event.impl;
public class RenderWorldEvent extends Event{
private final float partialTicks;
public RenderWorldEvent(float partialTicks) {
this.partialTicks = partialTicks;
}
public float getPartialTicks() {
return partialTicks;
}
}

View File

@ -63,7 +63,7 @@ public class ModManager {
public static AutoGG autoGG;
public static AutoRespawn autoRespawn;
public static Freelook freelook;
public static ComboCounter comboCounter;
public static ComboCounter comboCounter = new ComboCounter();
public static Hitboxes hitboxes = new Hitboxes();
public static Health health;
//public static ChunkBorders chunkBorders;
@ -100,7 +100,7 @@ public class ModManager {
register(cps = new CPS());
register(potionHud = new PotionHUD());
register(reachDisplay = new ReachDisplay());
register(comboCounter = new ComboCounter());
register(comboCounter);
register(coordinate = new Info());
register(fps = new FPS());
register(health = new Health());

View File

@ -1,14 +1,14 @@
package dev.resent.module.impl.hud;
import java.util.ArrayList;
import java.util.List;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.setting.BooleanSetting;
import dev.resent.util.misc.FuncUtils;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import java.util.ArrayList;
import java.util.List;
public class CPS extends RenderModule {
public CPS() {
@ -16,7 +16,7 @@ public class CPS extends RenderModule {
addSetting(tshadow);
}
private List<Long> clicks = new ArrayList<>();
private final List<Long> clicks = new ArrayList<>();
private boolean wasPressed;
private long lastPressed;

View File

@ -1,11 +1,11 @@
package dev.resent.module.impl.hud;
import dev.resent.Resent;
import dev.resent.event.impl.EntityStatusEvent;
import dev.resent.event.impl.EventAttack;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.setting.BooleanSetting;
import net.minecraft.network.play.server.S19PacketEntityStatus;
public class ComboCounter extends RenderModule {
@ -17,27 +17,33 @@ public class ComboCounter extends RenderModule {
public ComboCounter() {
super("ComboCounter", Category.HUD, 4, 4, true);
addSetting(tshadow);
Resent.INSTANCE.events().subscribe(EntityStatusEvent.class, event -> {
if(this.isEnabled() && attacked && event.status == 2){
combo++;
attacked = false;
}
});
Resent.INSTANCE.events().subscribe(EventAttack.class, event -> {
if(this.isEnabled()){
if (this.isEnabled()) {
attacked = true;
lastAttack = System.nanoTime();
}
});
}
public int getWidth(){ return mc.fontRendererObj.getStringWidth("[0 Combo]") + 4; }
public int getHeight(){ return mc.fontRendererObj.FONT_HEIGHT + 4; }
public void onEntityHit(S19PacketEntityStatus event) {
if (this.isEnabled() && attacked && event.logicOpcode == 2) {
combo++;
attacked = false;
}
}
public int getWidth() {
return mc.fontRendererObj.getStringWidth("[0 Combo]") + 4;
}
public int getHeight() {
return mc.fontRendererObj.FONT_HEIGHT + 4;
}
@Override
public void draw() {
if(mc.thePlayer.hurtTime > 3 || System.nanoTime() - lastAttack >= 3.0E9 && this.enabled){
if (mc.thePlayer.hurtTime > 3 || System.nanoTime() - lastAttack >= 3.0E9 && this.enabled) {
combo = 0;
}

View File

@ -17,8 +17,13 @@ public class Info extends RenderModule{
public BooleanSetting direction = new BooleanSetting("Direction", "", true);
public static int yes = 6;
public int getWidth(){ return mc.fontRendererObj.getStringWidth("X: -99999999 + "); }
public int getHeight() { return mc.fontRendererObj.FONT_HEIGHT * yes; };
public int getWidth() {
return mc.fontRendererObj.getStringWidth("X: -99999999 + ");
}
public int getHeight() {
return mc.fontRendererObj.FONT_HEIGHT * yes;
}
@Override
public void draw() {

View File

@ -18,7 +18,7 @@ import net.minecraft.client.gui.Gui;
public class KeyStrokes extends RenderModule{
public static KeyStrokes INSTANCE = new KeyStrokes();
private Minecraft mc = Minecraft.getMinecraft();
private final Minecraft mc = Minecraft.getMinecraft();
public KeyStrokes(){
super("Keystrokes", Category.HUD, 25, 4, true);
@ -40,7 +40,7 @@ public class KeyStrokes extends RenderModule{
public List<Long> clicks = new ArrayList<>();
public boolean wasPressed;
public long lastPressed;
private List<Long> clicks2 = new ArrayList<>();
private final List<Long> clicks2 = new ArrayList<>();
public boolean wasPressed2;
public long lastPressed2;

View File

@ -169,11 +169,11 @@ public class Color {
rangeError = true;
badComponentString = badComponentString + " Green";
}
if ( b < 0 || b > 255) {
if (b < 0 || b > 255) {
rangeError = true;
badComponentString = badComponentString + " Blue";
}
if ( rangeError == true ) {
if (rangeError) {
throw new IllegalArgumentException("Color parameter outside of expected range:"
+ badComponentString);
}

View File

@ -2,7 +2,7 @@ package dev.resent.util.render;
public class RainbowUtil {
public static int getRainbow(float seconds,float saturation, float brightness) {
float hue = (System.currentTimeMillis()) % (int)(seconds*1000) / (float)(seconds*1000);
float hue = (System.currentTimeMillis()) % (int) (seconds * 1000) / (seconds * 1000);
int color = Color.HSBtoRGB(hue, saturation, brightness);
return color;
}

View File

@ -71,5 +71,5 @@ public @interface ManagedBean {
* java:module/&lt;bean-name&gt;
*
*/
public String value() default "";
String value() default "";
}

View File

@ -25,7 +25,7 @@ public @interface MatchesPattern {
int flags() default 0;
static class Checker implements TypeQualifierValidator<MatchesPattern> {
class Checker implements TypeQualifierValidator<MatchesPattern> {
public When forConstantValue(MatchesPattern annotation, Object value) {
Pattern p = Pattern.compile(annotation.value(), annotation.flags());
if (p.matcher(((String) value)).matches())

View File

@ -24,7 +24,7 @@ import javax.annotation.meta.When;
public @interface RegEx {
When when() default When.ALWAYS;
static class Checker implements TypeQualifierValidator<RegEx> {
class Checker implements TypeQualifierValidator<RegEx> {
public When forConstantValue(RegEx annotation, Object value) {
if (!(value instanceof String))

View File

@ -14,5 +14,6 @@ public interface TypeQualifierValidator<A extends Annotation> {
* @return a value indicating whether or not the value is an member of the
* values denoted by the type qualifier
*/
public @Nonnull When forConstantValue(@Nonnull A annotation, Object value);
@Nonnull
When forConstantValue(@Nonnull A annotation, Object value);
}

View File

@ -18,6 +18,6 @@ public enum When {
/** S intersection T is non empty and S - T is nonempty */
MAYBE,
/** S intersection T is empty */
NEVER;
NEVER
}

View File

@ -122,9 +122,7 @@ public interface EventBus<E> {
static <E> Accepts<E> nonCancelledWhenNotAcceptingCancelled() {
return (type, event, subscriber) -> {
if (!subscriber.acceptsCancelled()) {
if (event instanceof Cancellable && ((Cancellable) event).isCancelled()) {
return false;
}
return !(event instanceof Cancellable) || !((Cancellable) event).isCancelled();
}
return true;
};

Some files were not shown because too many files have changed in this diff Show More