Remove usage of ImmutableXX collectors from calsses that GRpc Android version will care.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=74880326
diff --git a/core/src/main/java/com/google/net/stubby/MethodDescriptor.java b/core/src/main/java/com/google/net/stubby/MethodDescriptor.java
index 377ece0..d5671fa 100644
--- a/core/src/main/java/com/google/net/stubby/MethodDescriptor.java
+++ b/core/src/main/java/com/google/net/stubby/MethodDescriptor.java
@@ -1,15 +1,14 @@
 package com.google.net.stubby;
 
-import com.google.common.base.Function;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
 
 import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.concurrent.TimeUnit;
 
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.Immutable;
 import javax.inject.Provider;
 
@@ -27,20 +26,12 @@
     UNKNOWN
   }
 
-  private  static final Function<Provider<String>,String> HEADER_SNAPSHOT =
-      new Function<Provider<String>, String>() {
-    @Override
-    public String apply(@Nullable Provider<String> headerProvider) {
-      return headerProvider == null ? null : headerProvider.get();
-    }
-  };
-
   private final Type type;
   private final String name;
   private final Marshaller<RequestT> requestMarshaller;
   private final Marshaller<ResponseT> responseMarshaller;
   private final long timeoutMicros;
-  private final ImmutableMap<String, Provider<String>> headers;
+  private final Map<String, Provider<String>> headers;
 
   public static <RequestT, ResponseT> MethodDescriptor<RequestT, ResponseT> create(
       Type type, String name, long timeout, TimeUnit timeoutUnit,
@@ -48,20 +39,20 @@
       Marshaller<ResponseT> responseMarshaller) {
     return new MethodDescriptor<RequestT, ResponseT>(
         type, name, timeoutUnit.toMicros(timeout), requestMarshaller, responseMarshaller,
-        ImmutableMap.<String, Provider<String>>of());
+        Collections.<String, Provider<String>>emptyMap());
   }
 
   private MethodDescriptor(Type type, String name, long timeoutMicros,
                            Marshaller<RequestT> requestMarshaller,
                            Marshaller<ResponseT> responseMarshaller,
-                           ImmutableMap<String, Provider<String>> headers) {
+                           Map<String, Provider<String>> headers) {
     this.type = Preconditions.checkNotNull(type);
     this.name = name;
     Preconditions.checkArgument(timeoutMicros > 0);
     this.timeoutMicros = timeoutMicros;
     this.requestMarshaller = requestMarshaller;
     this.responseMarshaller = responseMarshaller;
-    this.headers = headers;
+    this.headers = Collections.unmodifiableMap(headers);
   }
 
   /**
@@ -90,9 +81,13 @@
    */
   public Map<String, String> getHeaders() {
     if (headers.isEmpty()) {
-      return ImmutableMap.of();
+      return Collections.emptyMap();
     }
-    return ImmutableMap.copyOf(Maps.transformValues(headers, HEADER_SNAPSHOT));
+    Map<String, String> snapshot = new HashMap<String, String>();
+    for (Entry<String, Provider<String>> entry : headers.entrySet()) {
+      snapshot.put(entry.getKey(), entry.getValue().get());
+    }
+    return Collections.unmodifiableMap(snapshot);
   }
 
   /**
@@ -122,20 +117,20 @@
    */
   public MethodDescriptor<RequestT, ResponseT> withHeader(String headerName,
       Provider<String> headerValueProvider) {
+    Map<String, Provider<String>> newHeaders = new HashMap<String, Provider<String>>(headers);
+    newHeaders.put(headerName, headerValueProvider);
     return new MethodDescriptor<RequestT, ResponseT>(type, name, timeoutMicros,
-        requestMarshaller, responseMarshaller,
-        ImmutableMap.<String, Provider<String>>builder().
-            putAll(headers).put(headerName, headerValueProvider).build());
+        requestMarshaller, responseMarshaller, newHeaders);
   }
 
   /**
    * Creates a new descriptor with additional bound headers.
    */
   public MethodDescriptor<RequestT, ResponseT> withHeaders(
-      ImmutableMap<String, Provider<String>> additionalHeaders) {
+      Map<String, Provider<String>> additionalHeaders) {
+    Map<String, Provider<String>> newHeaders = new HashMap<String, Provider<String>>(headers);
+    newHeaders.putAll(additionalHeaders);
     return new MethodDescriptor<RequestT, ResponseT>(type, name, timeoutMicros,
-        requestMarshaller, responseMarshaller,
-        ImmutableMap.<String, Provider<String>>builder().
-            putAll(headers).putAll(additionalHeaders).build());
+        requestMarshaller, responseMarshaller, newHeaders);
   }
 }
diff --git a/core/src/main/java/com/google/net/stubby/newtransport/okhttp/OkHttpClientTransport.java b/core/src/main/java/com/google/net/stubby/newtransport/okhttp/OkHttpClientTransport.java
index f90957d..22350b6 100644
--- a/core/src/main/java/com/google/net/stubby/newtransport/okhttp/OkHttpClientTransport.java
+++ b/core/src/main/java/com/google/net/stubby/newtransport/okhttp/OkHttpClientTransport.java
@@ -2,7 +2,6 @@
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableMap;
 import com.google.common.io.ByteStreams;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.net.stubby.MethodDescriptor;
@@ -52,26 +51,37 @@
   @VisibleForTesting
   static final int DEFAULT_INITIAL_WINDOW_SIZE = 64 * 1024;
 
-  private static final ImmutableMap<ErrorCode, Status> ERROR_CODE_TO_STATUS = ImmutableMap
-      .<ErrorCode, Status>builder()
-      .put(ErrorCode.NO_ERROR, Status.OK)
-      .put(ErrorCode.PROTOCOL_ERROR, new Status(Transport.Code.INTERNAL, "Protocol error"))
-      .put(ErrorCode.INVALID_STREAM, new Status(Transport.Code.INTERNAL, "Invalid stream"))
-      .put(ErrorCode.UNSUPPORTED_VERSION,
-          new Status(Transport.Code.INTERNAL, "Unsupported version"))
-      .put(ErrorCode.STREAM_IN_USE, new Status(Transport.Code.INTERNAL, "Stream in use"))
-      .put(ErrorCode.STREAM_ALREADY_CLOSED,
-          new Status(Transport.Code.INTERNAL, "Stream already closed"))
-      .put(ErrorCode.INTERNAL_ERROR, new Status(Transport.Code.INTERNAL, "Internal error"))
-      .put(ErrorCode.FLOW_CONTROL_ERROR, new Status(Transport.Code.INTERNAL, "Flow control error"))
-      .put(ErrorCode.STREAM_CLOSED, new Status(Transport.Code.INTERNAL, "Stream closed"))
-      .put(ErrorCode.FRAME_TOO_LARGE, new Status(Transport.Code.INTERNAL, "Frame too large"))
-      .put(ErrorCode.REFUSED_STREAM, new Status(Transport.Code.INTERNAL, "Refused stream"))
-      .put(ErrorCode.CANCEL, new Status(Transport.Code.CANCELLED, "Cancelled"))
-      .put(ErrorCode.COMPRESSION_ERROR, new Status(Transport.Code.INTERNAL, "Compression error"))
-      .put(ErrorCode.INVALID_CREDENTIALS,
-          new Status(Transport.Code.PERMISSION_DENIED, "Invalid credentials"))
-      .build();
+  private static final Map<ErrorCode, Status> ERROR_CODE_TO_STATUS;
+  static {
+    Map<ErrorCode, Status> errorToStatus = new HashMap<ErrorCode, Status>();
+    errorToStatus.put(ErrorCode.NO_ERROR, Status.OK);
+    errorToStatus.put(ErrorCode.PROTOCOL_ERROR,
+        new Status(Transport.Code.INTERNAL, "Protocol error"));
+    errorToStatus.put(ErrorCode.INVALID_STREAM,
+        new Status(Transport.Code.INTERNAL, "Invalid stream"));
+    errorToStatus.put(ErrorCode.UNSUPPORTED_VERSION,
+        new Status(Transport.Code.INTERNAL, "Unsupported version"));
+    errorToStatus.put(ErrorCode.STREAM_IN_USE,
+        new Status(Transport.Code.INTERNAL, "Stream in use"));
+    errorToStatus.put(ErrorCode.STREAM_ALREADY_CLOSED,
+        new Status(Transport.Code.INTERNAL, "Stream already closed"));
+    errorToStatus.put(ErrorCode.INTERNAL_ERROR,
+        new Status(Transport.Code.INTERNAL, "Internal error"));
+    errorToStatus.put(ErrorCode.FLOW_CONTROL_ERROR,
+        new Status(Transport.Code.INTERNAL, "Flow control error"));
+    errorToStatus.put(ErrorCode.STREAM_CLOSED,
+        new Status(Transport.Code.INTERNAL, "Stream closed"));
+    errorToStatus.put(ErrorCode.FRAME_TOO_LARGE,
+        new Status(Transport.Code.INTERNAL, "Frame too large"));
+    errorToStatus.put(ErrorCode.REFUSED_STREAM,
+        new Status(Transport.Code.INTERNAL, "Refused stream"));
+    errorToStatus.put(ErrorCode.CANCEL, new Status(Transport.Code.CANCELLED, "Cancelled"));
+    errorToStatus.put(ErrorCode.COMPRESSION_ERROR,
+        new Status(Transport.Code.INTERNAL, "Compression error"));
+    errorToStatus.put(ErrorCode.INVALID_CREDENTIALS,
+        new Status(Transport.Code.PERMISSION_DENIED, "Invalid credentials"));
+    ERROR_CODE_TO_STATUS = Collections.unmodifiableMap(errorToStatus);
+  }
 
   private final String host;
   private final int port;