# Deprecated API

## Contents

- Deprecated Interfaces
- Deprecated Classes
- Deprecated Methods

- Deprecated Interfaces
  Interface and Description
  com.google.common.util.concurrent.FutureFallback This interface's main user, `Futures.withFallback`, has been updated to use `AsyncFunction`. We recommend that other APIs be updated in the same way. This interface will be removed in Guava release 20.0.
  com.google.common.io.InputSupplier For `InputSupplier<? extends InputStream>`, use `ByteSource` instead. For `InputSupplier<? extends Reader>`, use `CharSource`. Implementations of `InputSupplier` that don't fall into one of those categories do not benefit from any of the methods in `common.io` and should use a different interface. This interface is scheduled for removal in December 2015.
  com.google.common.collect.MapConstraint Use `Preconditions` for basic checks. In place of constrained maps, we encourage you to check your preconditions explicitly instead of leaving that work to the map implementation. For the specific case of rejecting null, consider `ImmutableMap`. This class is scheduled for removal in Guava 20.0.
  com.google.common.io.OutputSupplier For `OutputSupplier<? extends OutputStream>`, use `ByteSink` instead. For `OutputSupplier<? extends Writer>`, use `CharSink`. Implementations of `OutputSupplier` that don't fall into one of those categories do not benefit from any of the methods in `common.io` and should use a different interface. This interface is scheduled for removal in December 2015.

- Deprecated Classes
  Class and Description
  com.google.common.collect.MapConstraints Use `Preconditions` for basic checks. In place of constrained maps, we encourage you to check your preconditions explicitly instead of leaving that work to the map implementation. For the specific case of rejecting null, consider `ImmutableMap`. This class is scheduled for removal in Guava 20.0.
  com.google.common.base.Objects.ToStringHelper Use `MoreObjects.ToStringHelper` instead. This class is scheduled for removal in June 2016.

- Deprecated Methods
  Method and Description
  com.google.common.collect.ImmutableCollection.add(E) Unsupported operation.
  com.google.common.collect.UnmodifiableListIterator.add(E) Unsupported operation.
  com.google.common.collect.ImmutableMultiset.add(E, int) Unsupported operation.
  com.google.common.collect.ImmutableList.add(int, E) Unsupported operation.
  com.google.common.collect.ImmutableCollection.addAll(Collection) Unsupported operation.
  com.google.common.collect.ImmutableList.addAll(int, Collection) Unsupported operation.
  com.google.common.base.Converter.apply(A) Provided to satisfy the `Function` interface; use `Converter.convert(A)` instead.
  com.google.common.collect.Range.apply(C) Provided only to satisfy the `Predicate` interface; use `Range.contains(C)` instead.
  com.google.common.base.CharMatcher.apply(Character) Provided only to satisfy the `Predicate` interface; use `CharMatcher.matches(char)` instead.
  com.google.common.cache.LoadingCache.apply(K) Provided to satisfy the `Function` interface; use `LoadingCache.get(K)` or `LoadingCache.getUnchecked(K)` instead.
  com.google.common.hash.BloomFilter.apply(T) Provided only to satisfy the `Predicate` interface; use `BloomFilter.mightContain(T)` instead.
  com.google.common.collect.ContiguousSet.builder() Use `ContiguousSet.create(com.google.common.collect.Range<C>, com.google.common.collect.DiscreteDomain<C>)`.
  com.google.common.collect.ArrayTable.clear() Use `ArrayTable.eraseAll()`
  com.google.common.collect.ImmutableMultimap.clear() Unsupported operation.
  com.google.common.collect.ImmutableCollection.clear() Unsupported operation.
  com.google.common.collect.ImmutableMap.clear() Unsupported operation.
  com.google.common.collect.ImmutableTable.clear() Unsupported operation.
  com.google.common.collect.ComparisonChain.compare(Boolean, Boolean) Use `ComparisonChain.compareFalseFirst(boolean, boolean)`; or, if the parameters passed are being either negated or reversed, undo the negation or reversal and use `ComparisonChain.compareTrueFirst(boolean, boolean)`.
  com.google.common.collect.Iterators.emptyIterator() Use `ImmutableSet.<T>of().iterator()` instead; or for Java 7 or later, `Collections.emptyIterator()`. This method is scheduled for removal in May 2016.
  com.google.common.base.Objects.firstNonNull(T, T) Use `MoreObjects.firstNonNull(T, T)` instead. This method is scheduled for removal in June 2016.
  com.google.common.collect.ImmutableBiMap.forcePut(K, V) Unsupported operation.
  com.google.common.collect.FluentIterable.from(FluentIterable) instances of `FluentIterable` don't need to be converted to `FluentIterable`
  com.google.common.collect.Ordering.from(Ordering) no need to use this
  com.google.common.util.concurrent.Futures.get(Future, Class) Use `Futures.getChecked(Future, Class)`. This method will be removed in Guava release 20.0.
  com.google.common.util.concurrent.Futures.get(Future, long, TimeUnit, Class) Use `Futures.getChecked(Future, Class, long, TimeUnit)`, noting the change in parameter order. This method will be removed in Guava release 20.0.
  com.google.common.hash.Hasher.hashCode() This returns `Object.hashCode()`; you almost certainly mean to call `hash().asInt()`.
  com.google.common.reflect.TypeToken.isAssignableFrom(Type) Use the method under its new name, `TypeToken.isSupertypeOf(Type)`. This method will be removed in Guava release 20.0.
  com.google.common.reflect.TypeToken.isAssignableFrom(TypeToken) Use the method under its new name, `TypeToken.isSupertypeOf(TypeToken)`. This method will be removed in Guava release 20.0.
  com.google.common.collect.Sets.newSetFromMap(Map) Use `Collections.newSetFromMap(java.util.Map<E, java.lang.Boolean>)` instead. This method will be removed in August 2017.
  com.google.common.collect.ImmutableSortedMap.Builder.orderEntriesByValue(Comparator) Unsupported by ImmutableSortedMap.Builder.
  com.google.common.collect.Iterators.peekingIterator(PeekingIterator) no need to use this
  com.google.common.collect.ImmutableSortedSet.pollFirst() Unsupported operation.
  com.google.common.collect.ImmutableSortedMultiset.pollFirstEntry() Unsupported operation.
  com.google.common.collect.ImmutableSortedMap.pollFirstEntry() Unsupported operation.
  com.google.common.collect.ImmutableSortedSet.pollLast() Unsupported operation.
  com.google.common.collect.ImmutableSortedMultiset.pollLastEntry() Unsupported operation.
  com.google.common.collect.ImmutableSortedMap.pollLastEntry() Unsupported operation.
  com.google.common.collect.ImmutableMultimap.put(K, V) Unsupported operation.
  com.google.common.collect.ImmutableMap.put(K, V) Unsupported operation.
  com.google.common.collect.ImmutableTable.put(R, C, V) Unsupported operation.
  com.google.common.collect.ImmutableMultimap.putAll(K, Iterable) Unsupported operation.
  com.google.common.collect.ImmutableMap.putAll(Map) Unsupported operation.
  com.google.common.collect.ImmutableMultimap.putAll(Multimap) Unsupported operation.
  com.google.common.collect.ImmutableTable.putAll(Table) Unsupported operation.
  com.google.common.collect.ImmutableClassToInstanceMap.putInstance(Class, T) Unsupported operation.
  com.google.common.collect.UnmodifiableIterator.remove() Unsupported operation.
  com.google.common.collect.ImmutableList.remove(int) Unsupported operation.
  com.google.common.collect.ImmutableCollection.remove(Object) Unsupported operation.
  com.google.common.collect.ImmutableMap.remove(Object) Unsupported operation.
  com.google.common.collect.ImmutableMultiset.remove(Object, int) Unsupported operation.
  com.google.common.collect.ArrayTable.remove(Object, Object) Use `ArrayTable.erase(java.lang.Object, java.lang.Object)`
  com.google.common.collect.ImmutableMultimap.remove(Object, Object) Unsupported operation.
  com.google.common.collect.ImmutableTable.remove(Object, Object) Unsupported operation.
  com.google.common.collect.ImmutableCollection.removeAll(Collection) Unsupported operation.
  com.google.common.collect.ImmutableListMultimap.removeAll(Object) Unsupported operation.
  com.google.common.collect.ImmutableMultimap.removeAll(Object) Unsupported operation.
  com.google.common.collect.ImmutableSetMultimap.removeAll(Object) Unsupported operation.
  com.google.common.collect.ImmutableListMultimap.replaceValues(K, Iterable) Unsupported operation.
  com.google.common.collect.ImmutableMultimap.replaceValues(K, Iterable) Unsupported operation.
  com.google.common.collect.ImmutableSetMultimap.replaceValues(K, Iterable) Unsupported operation.
  com.google.common.collect.ImmutableCollection.retainAll(Collection) Unsupported operation.
  com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor() Use `MoreExecutors.directExecutor()` if you only require an `Executor` and `MoreExecutors.newDirectExecutorService()` if you need a `ListeningExecutorService`. This method will be removed in August 2016.
  com.google.common.collect.UnmodifiableListIterator.set(E) Unsupported operation.
  com.google.common.collect.ImmutableList.set(int, E) Unsupported operation.
  com.google.common.collect.ImmutableMultiset.setCount(E, int) Unsupported operation.
  com.google.common.collect.ImmutableMultiset.setCount(E, int, int) Unsupported operation.
  com.google.common.base.Objects.toStringHelper(Class) Use `MoreObjects.toStringHelper(Class)` instead. This method is scheduled for removal in June 2016.
  com.google.common.base.Objects.toStringHelper(Object) Use `MoreObjects.toStringHelper(Object)` instead. This method is scheduled for removal in June 2016.
  com.google.common.base.Objects.toStringHelper(String) Use `MoreObjects.toStringHelper(String)` instead. This method is scheduled for removal in June 2016.
  com.google.common.util.concurrent.Futures.transform(ListenableFuture, AsyncFunction) These `AsyncFunction` overloads of `transform` are being renamed to `transformAsync`. (The `Function` overloads are keeping the "transform" name.) This method will be removed in Guava release 20.0.
  com.google.common.util.concurrent.Futures.transform(ListenableFuture, AsyncFunction, Executor) These `AsyncFunction` overloads of `transform` are being renamed to `transformAsync`. (The `Function` overloads are keeping the "transform" name.) This method will be removed in Guava release 20.0.
  com.google.common.collect.Iterables.unmodifiableIterable(ImmutableCollection) no need to use this
  com.google.common.collect.Iterators.unmodifiableIterator(UnmodifiableIterator) no need to use this
  com.google.common.collect.Multimaps.unmodifiableListMultimap(ImmutableListMultimap) no need to use this
  com.google.common.collect.Multimaps.unmodifiableMultimap(ImmutableMultimap) no need to use this
  com.google.common.collect.Multisets.unmodifiableMultiset(ImmutableMultiset) no need to use this
  com.google.common.collect.Multimaps.unmodifiableSetMultimap(ImmutableSetMultimap) no need to use this
  com.google.common.util.concurrent.Futures.withFallback(ListenableFuture, FutureFallback) Use `catchingAsync(input, Throwable.class, fallbackImplementedAsAnAsyncFunction)`, usually replacing `Throwable.class` with the specific type you want to handle. This method will be removed in Guava release 20.0.
  com.google.common.util.concurrent.Futures.withFallback(ListenableFuture, FutureFallback, Executor) Use `catchingAsync(input, Throwable.class, fallbackImplementedAsAnAsyncFunction, executor)`, usually replacing `Throwable.class` with the specific type you want to handle. This method will be removed in Guava release 20.0.
  com.google.common.io.ByteArrayDataOutput.writeBytes(String) This method is dangerous as it discards the high byte of every character. For UTF-8, use `write(s.getBytes(Charsets.UTF_8))`.
  com.google.common.io.LittleEndianDataOutputStream.writeBytes(String) The semantics of `writeBytes(String s)` are considered dangerous. Please use `LittleEndianDataOutputStream.writeUTF(String s)`, `LittleEndianDataOutputStream.writeChars(String s)` or another write method instead.