Guava
Composite Recipes
Recipes that include further recipes, often including the individual recipes below.
- Inline methods annotated with
@InlineMe - Prefer
Integer#compareUnsigned - Prefer
Integer#divideUnsigned - Prefer
Long#compareUnsigned - Prefer
Long#divideUnsigned - Prefer
Math#addExact - Prefer
Math#clamp - Prefer
Math#multiplyExact - Prefer
Math#subtractExact - Prefer
java.util.Objects#equals - Prefer
java.util.Objects#hash - Prefer
java.util.Objects#requireNonNullElse - Prefer
java.util.Optional - Prefer
java.util.function.Predicate - Prefer the Java 11 standard library instead of Guava
- Prefer the Java 21 standard library instead of Guava
- Prefer the Java standard library instead of Guava
- Refaster style Guava to Java migration recipes
Recipes
Preconditions.checkNotNulltoObjects.requireNonNullPreconditions.checkNotNullwithObjectmessage toObjects.requireNonNullwithString.valueOfPreconditions.checkNotNullwithStringmessage toObjects.requireNonNull- Prefer
Arrays.asList(..)over Guava primitives - Prefer
Files#createTempDirectory() - Prefer
Integer#compare - Prefer
Integer#parseUnsignedInt - Prefer
Integer#remainderUnsigned - Prefer JDK methods for Maps and Sets of an expected size
- Prefer
List.of(..)in Java 9 or higher - Prefer
Long#compare - Prefer
Long#parseUnsignedInt - Prefer
Long#remainderUnsigned - Prefer
Map.of(..)in Java 9 or higher - Prefer
Predicate.and(Predicate) - Prefer
Runnable::run - Prefer
Set.of(..)in Java 9 or higher - Prefer
Short#compare - Prefer
String#join()over GuavaJoiner#join() - Prefer
java.lang.Char#compare - Prefer
java.nio.charset.StandardCharsets - Prefer
java.util.Collections#synchronizedNavigableMap - Prefer
java.util.Collections#unmodifiableNavigableMap - Prefer
java.util.Optional#or(Supplier<T extends java.util.Optional<T>>) - Prefer
java.util.Optional#orElse(null)overcom.google.common.base.Optional#orNull() - Prefer
java.util.function.Function - Prefer
java.util.function.Supplier - Prefer
new ArrayList<>() - Prefer
new AtomicReference<>() - Prefer
new ConcurrentHashMap<>() - Prefer
new CopyOnWriteArrayList<>() - Prefer
new HashMap<>() - Prefer
new HashSet<>() - Prefer
new LinkedHashMap<>() - Prefer
new LinkedHashSet<>() - Prefer
new LinkedList<>() - Prefer
new TreeMap<>() - Remove
com.google.common.base.Optional#toJavaUtil() - Replace
com.google.common.base.Optional#fromJavaUtil(java.util.Optional)with argument