Skip to content

Commit

Permalink
Remove open-source Maps class
Browse files Browse the repository at this point in the history
  • Loading branch information
IanChilds authored and tyronen committed May 31, 2015
1 parent 1379290 commit 92a6c49
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ public class ImmutableMap {
private ImmutableMap() {}

public static <K, V> Map<K, V> of() {
return Collections.unmodifiableMap(Maps.<K, V>newHashMap());
return Collections.unmodifiableMap(new HashMap<K, V>());
}

public static <K, V> Map<K, V> of(K k1, V v1) {
Map<K, V> map = Maps.newHashMap();
Map<K, V> map = new HashMap<>();
map.put(k1, v1);
return Collections.unmodifiableMap(map);
}

public static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2) {
Map<K, V> map = Maps.newHashMap();
Map<K, V> map = new HashMap<>();
map.put(k1, v1);
map.put(k2, v2);
return Collections.unmodifiableMap(map);
}

public static <K, V> Map<K, V> of(
K k1, V v1, K k2, V v2, K k3, V v3) {
Map<K, V> map = Maps.newHashMap();
Map<K, V> map = new HashMap<>();
map.put(k1, v1);
map.put(k2, v2);
map.put(k3, v3);
Expand All @@ -50,7 +50,7 @@ public static <K, V> Map<K, V> of(

public static <K, V> Map<K, V> of(
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
Map<K, V> map = Maps.newHashMap();
Map<K, V> map = new HashMap<>();
map.put(k1, v1);
map.put(k2, v2);
map.put(k3, v3);
Expand All @@ -60,7 +60,7 @@ public static <K, V> Map<K, V> of(

public static <K, V> Map<K, V> of(
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
Map<K, V> map = Maps.newHashMap();
Map<K, V> map = new HashMap<>();
map.put(k1, v1);
map.put(k2, v2);
map.put(k3, v3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/**
* Static utility methods pertaining to {@link List} instances. Also see this
* class's counterparts {@link Sets}, {@link Maps} and {@link Queues}.
* class's counterpart {@link Sets}.
*
* <p>See the Guava User Guide article on <a href=
* "http://code.google.com/p/guava-libraries/wiki/CollectionUtilitiesExplained#Lists">
Expand Down
52 changes: 0 additions & 52 deletions fbcore/src/main/java/com/facebook/common/internal/Maps.java

This file was deleted.

3 changes: 2 additions & 1 deletion fbcore/src/main/java/com/facebook/common/internal/Sets.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
Expand Down Expand Up @@ -107,7 +108,7 @@ public static <E> HashSet<E> newHashSet(Iterator<? extends E> elements) {
* to the way {@code IdentityHashMap} handles key lookups.
*/
public static <E> Set<E> newIdentityHashSet() {
return Sets.newSetFromMap(Maps.<E, Boolean>newIdentityHashMap());
return Sets.newSetFromMap(new IdentityHashMap<E, Boolean>());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

import javax.annotation.concurrent.GuardedBy;

import java.util.IdentityHashMap;
import java.util.Map;

import com.facebook.common.internal.Maps;
import com.facebook.common.internal.VisibleForTesting;
import com.facebook.common.internal.Preconditions;
import com.facebook.common.logging.FLog;
Expand Down Expand Up @@ -101,7 +101,7 @@ public class SharedReference<T> {
// SharedReference first disposes of it. Note, this does not prevent CloseableReference's from
// being finalized when the reference is no longer reachable.
@GuardedBy("itself")
private static final Map<Object, Integer> sLiveObjects = Maps.newIdentityHashMap();
private static final Map<Object, Integer> sLiveObjects = new IdentityHashMap<>();

@GuardedBy("this")
private T mValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.facebook.binaryresource.BinaryResource;
import com.facebook.cache.common.WriterCallback;
import com.facebook.common.internal.Maps;

/**
* Storage for files in the cache.
Expand All @@ -43,7 +43,7 @@ public static class DiskDumpInfo {
public Map<String, Integer> typeCounts;
public DiskDumpInfo() {
entries = new ArrayList<>();
typeCounts = Maps.newHashMap();
typeCounts = new HashMap<>();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

import javax.annotation.concurrent.GuardedBy;

import java.util.HashMap;
import java.util.Map;

import com.facebook.common.internal.Maps;
import com.facebook.common.internal.Preconditions;
import com.facebook.common.logging.FLog;
import com.facebook.common.references.CloseableReference;
Expand All @@ -32,7 +32,7 @@ public class StagingArea {
private Map<CacheKey, CloseableReference<PooledByteBuffer>> mMap;

private StagingArea() {
mMap = Maps.newHashMap();
mMap = new HashMap<>();
}

public static StagingArea getInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

package com.facebook.imagepipeline.core;

import java.util.HashMap;
import java.util.Map;

import android.net.Uri;
import android.os.Build;
import android.util.Pair;

import com.facebook.common.internal.Maps;
import com.facebook.common.internal.Preconditions;
import com.facebook.common.internal.VisibleForTesting;
import com.facebook.common.media.MediaUtils;
Expand All @@ -27,7 +27,6 @@
import com.facebook.imagepipeline.producers.BitmapMemoryCacheKeyMultiplexProducer;
import com.facebook.imagepipeline.producers.BitmapMemoryCacheProducer;
import com.facebook.imagepipeline.producers.BranchOnSeparateImagesProducer;
import com.facebook.imagepipeline.producers.DataFetchProducer;
import com.facebook.imagepipeline.producers.DecodeProducer;
import com.facebook.imagepipeline.producers.EncodedMemoryCacheProducer;
import com.facebook.imagepipeline.producers.ImageTransformMetaData;
Expand Down Expand Up @@ -80,8 +79,8 @@ public ProducerSequenceFactory(
mProducerFactory = producerFactory;
mNetworkFetcher = networkFetcher;
mResizeAndRotateEnabledForNetwork = resizeAndRotateEnabledForNetwork;
mPostprocessorSequences = Maps.newHashMap();
mCloseableImagePrefetchSequences = Maps.newHashMap();
mPostprocessorSequences = new HashMap<>();
mCloseableImagePrefetchSequences = new HashMap<>();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArraySet;

import android.util.Pair;

import com.facebook.common.internal.Maps;
import com.facebook.common.internal.Preconditions;
import com.facebook.common.internal.Sets;
import com.facebook.common.internal.VisibleForTesting;
Expand Down Expand Up @@ -54,9 +54,9 @@ public abstract class MultiplexProducer<K, T> implements Producer<CloseableRefer
@VisibleForTesting final Map<K, Multiplexer> mMultiplexers;
private final Producer<CloseableReference<T>> mNextProducer;

protected MultiplexProducer(Producer nextProducer) {
protected MultiplexProducer(Producer<CloseableReference<T>> nextProducer) {
mNextProducer = nextProducer;
mMultiplexers = Maps.newHashMap();
mMultiplexers = new HashMap<>();
}

@Override
Expand Down

0 comments on commit 92a6c49

Please sign in to comment.