Bump Guava to 21.0

Change-Id: Id81705773d191db6a18153d8b2dd4abd2bfd0e60
diff --git a/apps/newoptical/src/main/java/org/onosproject/newoptical/OpticalPathProvisioner.java b/apps/newoptical/src/main/java/org/onosproject/newoptical/OpticalPathProvisioner.java
index 245a90f..b25d568 100644
--- a/apps/newoptical/src/main/java/org/onosproject/newoptical/OpticalPathProvisioner.java
+++ b/apps/newoptical/src/main/java/org/onosproject/newoptical/OpticalPathProvisioner.java
@@ -30,7 +30,6 @@
 import org.onlab.graph.ScalarWeight;
 import org.onlab.graph.Weight;
 import org.onlab.util.Bandwidth;
-import org.onlab.util.GuavaCollectors;
 import org.onlab.util.KryoNamespace;
 import org.onlab.util.Tools;
 import org.onosproject.cluster.ClusterService;
@@ -274,7 +273,7 @@
     public Collection<OpticalConnectivity> listConnectivity() {
         return connectivityMap.values().stream()
             .map(Versioned::value)
-            .collect(GuavaCollectors.toImmutableList());
+            .collect(ImmutableList.toImmutableList());
     }
 
     @Override
diff --git a/core/common/src/main/java/org/onosproject/common/DefaultTopology.java b/core/common/src/main/java/org/onosproject/common/DefaultTopology.java
index dd2f3a9..81822c1 100644
--- a/core/common/src/main/java/org/onosproject/common/DefaultTopology.java
+++ b/core/common/src/main/java/org/onosproject/common/DefaultTopology.java
@@ -35,7 +35,6 @@
 import org.onlab.graph.TarjanGraphSearch;
 import org.onlab.graph.TarjanGraphSearch.SccResult;
 import org.onlab.graph.Weight;
-import org.onlab.util.GuavaCollectors;
 import org.onosproject.net.AbstractModel;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DefaultDisjointPath;
@@ -437,7 +436,7 @@
         return KSHORTEST.search(graph, srcV, dstV, weigher, maxPaths)
                 .paths().stream()
                     .map(this::networkPath)
-                    .collect(GuavaCollectors.toImmutableSet());
+                    .collect(ImmutableSet.toImmutableSet());
     }
 
     /**
diff --git a/core/net/src/main/java/org/onosproject/net/resource/impl/ResourceDeviceListener.java b/core/net/src/main/java/org/onosproject/net/resource/impl/ResourceDeviceListener.java
index 7ba0296..ad90f79 100644
--- a/core/net/src/main/java/org/onosproject/net/resource/impl/ResourceDeviceListener.java
+++ b/core/net/src/main/java/org/onosproject/net/resource/impl/ResourceDeviceListener.java
@@ -21,7 +21,6 @@
 import org.onlab.packet.MplsLabel;
 import org.onlab.packet.VlanId;
 import org.onlab.util.Bandwidth;
-import org.onlab.util.GuavaCollectors;
 import org.onlab.util.ItemNotFoundException;
 import org.onosproject.mastership.MastershipService;
 import org.onosproject.net.ChannelSpacing;
@@ -284,7 +283,7 @@
             if (query != null) {
                 return query.queryLambdas(port).stream()
                         .flatMap(ResourceDeviceListener::toResourceGrid)
-                        .collect(GuavaCollectors.toImmutableSet());
+                        .collect(ImmutableSet.toImmutableSet());
             } else {
                 return Collections.emptySet();
             }
diff --git a/core/net/src/main/java/org/onosproject/net/resource/impl/ResourceManager.java b/core/net/src/main/java/org/onosproject/net/resource/impl/ResourceManager.java
index 606c80d..7857e40 100644
--- a/core/net/src/main/java/org/onosproject/net/resource/impl/ResourceManager.java
+++ b/core/net/src/main/java/org/onosproject/net/resource/impl/ResourceManager.java
@@ -23,7 +23,6 @@
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.apache.felix.scr.annotations.Service;
-import org.onlab.util.GuavaCollectors;
 import org.onlab.util.Tools;
 import org.onosproject.event.AbstractListenerManager;
 import org.onosproject.net.resource.DiscreteResourceId;
@@ -133,7 +132,7 @@
         Collection<Resource> resources = store.getAllocatedResources(parent, cls);
         return resources.stream()
                 .flatMap(resource -> store.getResourceAllocations(resource.id()).stream())
-                .collect(GuavaCollectors.toImmutableList());
+                .collect(ImmutableList.toImmutableList());
     }
 
     @Override
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentContinuousResourceSubStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentContinuousResourceSubStore.java
index 79aed3b..785ae31 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentContinuousResourceSubStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentContinuousResourceSubStore.java
@@ -17,7 +17,6 @@
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
-import org.onlab.util.GuavaCollectors;
 import org.onosproject.net.resource.ContinuousResource;
 import org.onosproject.net.resource.ContinuousResourceId;
 import org.onosproject.net.resource.DiscreteResourceId;
@@ -74,7 +73,7 @@
 
         return allocations.value().allocations().stream()
                 .filter(x -> x.resource().id().equals(resource))
-                .collect(GuavaCollectors.toImmutableList());
+                .collect(ImmutableList.toImmutableList());
     }
 
     @Override
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ContinuousResourceAllocation.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ContinuousResourceAllocation.java
index 03dc713..a14313f 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ContinuousResourceAllocation.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ContinuousResourceAllocation.java
@@ -16,7 +16,6 @@
 package org.onosproject.store.resource.impl;
 
 import com.google.common.collect.ImmutableList;
-import org.onlab.util.GuavaCollectors;
 import org.onosproject.net.resource.ContinuousResource;
 import org.onosproject.net.resource.ResourceAllocation;
 import org.onosproject.net.resource.ResourceConsumerId;
@@ -93,7 +92,7 @@
 
         return new ContinuousResourceAllocation(original,
                 Stream.concat(nonMatched.stream(), matched.stream())
-                        .collect(GuavaCollectors.toImmutableList()));
+                        .collect(ImmutableList.toImmutableList()));
     }
 
     @Override
diff --git a/drivers/default/src/main/java/org/onosproject/driver/query/FullVlanAvailable.java b/drivers/default/src/main/java/org/onosproject/driver/query/FullVlanAvailable.java
index ab9d494..3664077 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/query/FullVlanAvailable.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/query/FullVlanAvailable.java
@@ -20,7 +20,6 @@
 
 import com.google.common.collect.ImmutableSet;
 import org.onlab.packet.VlanId;
-import org.onlab.util.GuavaCollectors;
 import org.onosproject.net.PortNumber;
 import org.onosproject.net.behaviour.VlanQuery;
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
@@ -50,7 +49,7 @@
         return IntStream.range(0, MAX_VLAN_ID)
                 .filter(x -> !EXCLUDED.contains(x))
                 .mapToObj(x -> VlanId.vlanId((short) x))
-                .collect(GuavaCollectors.toImmutableSet());
+                .collect(ImmutableSet.toImmutableSet());
     }
 
 }
diff --git a/drivers/optical/src/main/java/org/onosproject/driver/optical/query/LincOELambdaQuery.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/query/LincOELambdaQuery.java
index d7fc40a..4a86085 100644
--- a/drivers/optical/src/main/java/org/onosproject/driver/optical/query/LincOELambdaQuery.java
+++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/query/LincOELambdaQuery.java
@@ -15,7 +15,6 @@
  */
 package org.onosproject.driver.optical.query;
 
-import org.onlab.util.GuavaCollectors;
 import org.onosproject.net.ChannelSpacing;
 import org.onosproject.net.GridType;
 import org.onosproject.net.OchSignal;
@@ -49,7 +48,7 @@
      */
     private static final Set<OchSignal> OMS_LAMBDAS = IntStream.range(0, LAMBDA_COUNT)
             .mapToObj(x -> new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, x - (LAMBDA_COUNT / 2), 4))
-            .collect(GuavaCollectors.toImmutableSet());
+            .collect(ImmutableSet.toImmutableSet());
 
     @Override
     public Set<OchSignal> queryLambdas(PortNumber port) {
diff --git a/features/features.xml b/features/features.xml
index 7403b25..293fbd0 100644
--- a/features/features.xml
+++ b/features/features.xml
@@ -23,7 +23,7 @@
         <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
         <bundle>mvn:org.apache.commons/commons-lang3/3.5</bundle>
         <bundle>mvn:commons-configuration/commons-configuration/1.10</bundle>
-        <bundle>mvn:com.google.guava/guava/20.0</bundle>
+        <bundle>mvn:com.google.guava/guava/21.0</bundle>
         <bundle>mvn:io.netty/netty/3.10.5.Final</bundle>
         <bundle>mvn:io.netty/netty-common/4.1.5.Final</bundle>
         <bundle>mvn:io.netty/netty-buffer/4.1.5.Final</bundle>
diff --git a/lib/BUCK b/lib/BUCK
index 6867754..33b6d50 100644
--- a/lib/BUCK
+++ b/lib/BUCK
@@ -312,19 +312,19 @@
 
 remote_jar (
   name = 'guava',
-  out = 'guava-20.0.jar',
-  url = 'mvn:com.google.guava:guava:jar:20.0',
-  sha1 = '89507701249388e1ed5ddcf8c41f4ce1be7831ef',
-  maven_coords = 'com.google.guava:guava:20.0',
+  out = 'guava-21.0.jar',
+  url = 'mvn:com.google.guava:guava:jar:21.0',
+  sha1 = '3a3d111be1be1b745edfa7d91678a12d7ed38709',
+  maven_coords = 'com.google.guava:guava:21.0',
   visibility = [ 'PUBLIC' ],
 )
 
 remote_jar (
   name = 'guava-testlib',
-  out = 'guava-testlib-20.0.jar',
-  url = 'mvn:com.google.guava:guava-testlib:jar:20.0',
-  sha1 = 'e3666edd0d7b10ddfa5242b998efd831e4b264ff',
-  maven_coords = 'com.google.guava:guava-testlib:jar:NON-OSGI:20.0',
+  out = 'guava-testlib-21.0.jar',
+  url = 'mvn:com.google.guava:guava-testlib:jar:21.0',
+  sha1 = '1ec77c45666cf17da76cd80725194148a8ffc440',
+  maven_coords = 'com.google.guava:guava-testlib:jar:NON-OSGI:21.0',
   visibility = [ 'PUBLIC' ],
 )
 
@@ -1279,3 +1279,4 @@
   maven_coords = 'org.apache.sshd:sshd-core:1.4.0',
   visibility = [ 'PUBLIC' ],
 )
+
diff --git a/lib/deps.json b/lib/deps.json
index d4efb01..2790907 100644
--- a/lib/deps.json
+++ b/lib/deps.json
@@ -112,8 +112,8 @@
     "ganymed-ssh2": "mvn:ch.ethz.ganymed:ganymed-ssh2:262",
     "gmetric4j": "mvn:info.ganglia.gmetric4j:gmetric4j:1.0.10",
     "gson": "mvn:com.google.code.gson:gson:jar:2.6.2",
-    "guava": "mvn:com.google.guava:guava:20.0",
-    "guava-testlib": "mvn:com.google.guava:guava-testlib:20.0",
+    "guava": "mvn:com.google.guava:guava:21.0",
+    "guava-testlib": "mvn:com.google.guava:guava-testlib:21.0",
     "hamcrest-all": "mvn:org.hamcrest:hamcrest-all:1.3",
     "hk2-api": "mvn:org.glassfish.hk2:hk2-api:2.5.0-b32",
     "hk2-locator": "mvn:org.glassfish.hk2:hk2-locator:2.5.0-b32",
diff --git a/lib/pom.xml b/lib/pom.xml
index c7616bc..1462c01 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -46,7 +46,7 @@
         <jetty.version>9.2.21.v20170120</jetty.version>
         <jackson.version>2.8.6</jackson.version>
         <slf4j.version>1.7.21</slf4j.version>
-        <guava.version>20.0</guava.version>
+        <guava.version>21.0</guava.version>
         <commons.io.version>2.4</commons.io.version>
         <!-- TODO argLine was originally added maven-surfire-plugin configuration
                   to fix locale errors for non-US developers. However, it breaks
diff --git a/utils/misc/src/main/java/org/onlab/util/GuavaCollectors.java b/utils/misc/src/main/java/org/onlab/util/GuavaCollectors.java
index 429e56e..75d059e 100644
--- a/utils/misc/src/main/java/org/onlab/util/GuavaCollectors.java
+++ b/utils/misc/src/main/java/org/onlab/util/GuavaCollectors.java
@@ -34,7 +34,10 @@
      * @param <T> type
      * @return a {@code Collector} which collects all the input elements into a
      * {@code ImmutableSet}
+     *
+     * @deprecated in 1.11.0 consider using {@link ImmutableSet#toImmutableSet()} instead.
      */
+    @Deprecated
     public static <T> Collector<T, ImmutableSet.Builder<T>, ImmutableSet<T>> toImmutableSet() {
         return Collector.of(ImmutableSet.Builder<T>::new,
                             ImmutableSet.Builder<T>::add,
@@ -50,7 +53,10 @@
      * @param <T> type
      * @return a {@code Collector} which collects all the input elements into a
      * {@code ImmutableList}, in encounter order
+     *
+     * @deprecated in 1.11.0 consider using {@link ImmutableList#toImmutableList()} instead.
      */
+    @Deprecated
     public static <T> Collector<T, ImmutableList.Builder<T>, ImmutableList<T>> toImmutableList() {
         return Collector.of(ImmutableList.Builder<T>::new,
                             ImmutableList.Builder<T>::add,