diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/filters/SignRequest.java b/apis/atmos/src/main/java/org/jclouds/atmos/filters/SignRequest.java index c841049d59..11c8f9e081 100644 --- a/apis/atmos/src/main/java/org/jclouds/atmos/filters/SignRequest.java +++ b/apis/atmos/src/main/java/org/jclouds/atmos/filters/SignRequest.java @@ -23,7 +23,6 @@ import static org.jclouds.util.Patterns.NEWLINE_PATTERN; import static org.jclouds.util.Patterns.TWO_SPACE_PATTERN; import java.util.Set; -import java.util.TreeSet; import javax.annotation.Resource; import javax.inject.Inject; @@ -52,6 +51,7 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; import com.google.common.collect.Multimaps; +import com.google.common.collect.Sets; /** * Signs the EMC Atmos Online Storage request. @@ -141,7 +141,7 @@ public class SignRequest implements HttpRequestFilter { private void appendCanonicalizedHeaders(HttpRequest request, StringBuilder toSign) { // TreeSet == Sort the headers alphabetically. - Set headers = new TreeSet(request.getHeaders().keySet()); + Set headers = Sets.newTreeSet(request.getHeaders().keySet()); for (String header : headers) { if (header.startsWith("x-emc-") && !header.equals(AtmosHeaders.SIGNATURE)) { // Convert all header names to lowercase. diff --git a/apis/byon/src/main/java/org/jclouds/byon/Node.java b/apis/byon/src/main/java/org/jclouds/byon/Node.java index f649d7025e..3509b819ef 100644 --- a/apis/byon/src/main/java/org/jclouds/byon/Node.java +++ b/apis/byon/src/main/java/org/jclouds/byon/Node.java @@ -19,7 +19,6 @@ package org.jclouds.byon; import java.net.URI; -import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -27,6 +26,7 @@ import com.google.common.base.Objects; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; +import com.google.common.collect.Sets; /** * @@ -245,7 +245,7 @@ public class Node { } public Set getTags() { - Set tagSet = new HashSet(); + Set tagSet = Sets.newHashSet(); for (String tag : tags) tagSet.add(tag); return tagSet; diff --git a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeClientLiveTest.java b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeClientLiveTest.java index f3ddef1ba9..628707d158 100644 --- a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeClientLiveTest.java +++ b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeClientLiveTest.java @@ -22,7 +22,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import java.util.Arrays; -import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -30,6 +29,7 @@ import java.util.Map.Entry; import java.util.logging.Logger; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; import org.jclouds.cloudloadbalancers.domain.LoadBalancer; import org.jclouds.cloudloadbalancers.domain.LoadBalancerRequest; @@ -49,7 +49,7 @@ import org.testng.annotations.Test; */ @Test(groups = "live", singleThreaded = true, testName = "NodeClientLiveTest") public class NodeClientLiveTest extends BaseCloudLoadBalancersClientLiveTest { - private Map> nodes = new HashMap>(); + private Map> nodes = Maps.newHashMap(); @Test(groups = "live") public void testCreateLoadBalancers() { diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/options/CloneDriveOptions.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/options/CloneDriveOptions.java index fcb59d2cd5..33b399dcec 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/options/CloneDriveOptions.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/options/CloneDriveOptions.java @@ -68,7 +68,7 @@ public class CloneDriveOptions { Set currentTags = (currentTagsString == null) ? new HashSet() : Sets.newLinkedHashSet(Splitter.on(' ').split(currentTagsString)); - Set newTags = new LinkedHashSet(); + Set newTags = Sets.newLinkedHashSet(); for (String tag : tags) newTags.add(tag); diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java index 8f76971549..de06945d50 100644 --- a/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java +++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java @@ -31,7 +31,6 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URI; -import java.util.HashSet; import java.util.Iterator; import java.util.Properties; import java.util.Set; @@ -64,6 +63,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.google.common.base.Charsets; +import com.google.common.collect.Sets; import com.google.common.io.ByteStreams; import com.google.common.io.Closeables; import com.google.common.io.Files; @@ -136,7 +136,7 @@ public class FilesystemAsyncBlobStoreTest { */ public void testList_Root() throws IOException { PageSet containersRetrieved; - Set containersCreated = new HashSet(); + Set containersCreated = Sets.newHashSet(); // Testing list with no containers containersRetrieved = blobStore.list(); @@ -144,7 +144,7 @@ public class FilesystemAsyncBlobStoreTest { // Testing list with some containers String[] containerNames = new String[]{"34343", "aaaa", "bbbbb"}; - containersCreated = new HashSet(); + containersCreated = Sets.newHashSet(); for (String containerName : containerNames) { blobStore.createContainerInLocation(null, containerName); containersCreated.add(containerName); @@ -839,7 +839,7 @@ public class FilesystemAsyncBlobStoreTest { } // copies values - Set expectedBlobKeysCopy = new HashSet(); + Set expectedBlobKeysCopy = Sets.newHashSet(); for (String value : expectedBlobKeys) { expectedBlobKeysCopy.add(value); } diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImplTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImplTest.java index 8f83d35779..9e51446b7e 100644 --- a/apis/filesystem/src/test/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImplTest.java +++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImplTest.java @@ -27,8 +27,6 @@ import static org.testng.Assert.fail; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -49,6 +47,8 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import com.google.common.io.ByteStreams; import com.google.common.io.Files; import com.google.common.io.InputSupplier; @@ -305,7 +305,7 @@ public class FilesystemStorageStrategyImplTest { storageStrategy.createContainer(CONTAINER_NAME + "2"); storageStrategy.createContainer(CONTAINER_NAME + "3"); - List containers = new ArrayList(); + List containers = Lists.newArrayList(); resultList = storageStrategy.getAllContainerNames(); Iterator containersIterator = resultList.iterator(); while (containersIterator.hasNext()) { @@ -465,7 +465,7 @@ public class FilesystemStorageStrategyImplTest { TestUtils.createRandomBlobKey("346" + FS + "g3sx2" + FS + "removeBlob-", ".jpg"), TestUtils.createRandomBlobKey("346" + FS + "g3sx2" + FS + "removeBlob-", ".jpg") }); - Set remainingBlobKeys = new HashSet(); + Set remainingBlobKeys = Sets.newHashSet(); for (String key : blobKeys) { remainingBlobKeys.add(key); } @@ -507,7 +507,7 @@ public class FilesystemStorageStrategyImplTest { TestUtils.createRandomBlobKey("563" + FS + "g3sx2" + FS + "removeBlob-", ".jpg") }); storageStrategy.getBlobKeysInsideContainer(CONTAINER_NAME); - List retrievedBlobKeys = new ArrayList(); + List retrievedBlobKeys = Lists.newArrayList(); resultList = storageStrategy.getBlobKeysInsideContainer(CONTAINER_NAME); Iterator containersIterator = resultList.iterator(); while (containersIterator.hasNext()) { diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java index 6d6be707e1..a7764deaa8 100644 --- a/apis/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java +++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java @@ -24,7 +24,6 @@ import static org.testng.Assert.assertTrue; import java.io.File; import java.io.IOException; import java.util.Iterator; -import java.util.HashSet; import java.util.Set; import java.util.UUID; @@ -32,6 +31,7 @@ import org.jclouds.filesystem.util.Utils; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; +import com.google.common.collect.Sets; import com.google.common.io.Files; /** @@ -85,7 +85,7 @@ public class TestUtils { * @throws IOException */ public static Set createBlobsInContainer(String containerName, String... blobNames) throws IOException { - Set blobNamesCreatedInContainer = new HashSet(); + Set blobNamesCreatedInContainer = Sets.newHashSet(); for (String blobName : blobNames) { createBlobAsFile(containerName, blobName, getImageForBlobPayload()); blobNamesCreatedInContainer.add(blobName); diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/AccessControlList.java b/apis/s3/src/main/java/org/jclouds/s3/domain/AccessControlList.java index e0e3d0d3c4..ea4928ad57 100644 --- a/apis/s3/src/main/java/org/jclouds/s3/domain/AccessControlList.java +++ b/apis/s3/src/main/java/org/jclouds/s3/domain/AccessControlList.java @@ -19,17 +19,17 @@ package org.jclouds.s3.domain; import java.net.URI; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Set; -import java.util.TreeSet; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.Collections2; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; /** * An Access Control List (ACL) describes the access control settings for a bucket or object in S3. @@ -46,7 +46,7 @@ import com.google.common.collect.Collections2; public class AccessControlList { private CanonicalUser owner; - private final List grants = new ArrayList(); + private final List grants = Lists.newArrayList(); public void setOwner(CanonicalUser owner) { this.owner = owner; @@ -67,7 +67,7 @@ public class AccessControlList { * @return an unmodifiable set of grantees who have been assigned permissions in this ACL. */ public Set getGrantees() { - Set grantees = new TreeSet(); + Set grantees = Sets.newTreeSet(); for (Grant grant : getGrants()) { grantees.add(grant.getGrantee()); } diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/functions/ParseContainerListFromJsonResponseTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/functions/ParseContainerListFromJsonResponseTest.java index 0a1f3f0eea..6b187d5d64 100644 --- a/apis/swift/src/test/java/org/jclouds/openstack/swift/functions/ParseContainerListFromJsonResponseTest.java +++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/functions/ParseContainerListFromJsonResponseTest.java @@ -21,7 +21,6 @@ package org.jclouds.openstack.swift.functions; import static org.testng.Assert.assertEquals; import java.io.InputStream; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -33,6 +32,7 @@ import org.jclouds.util.Strings2; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Maps; import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.Key; @@ -51,7 +51,7 @@ public class ParseContainerListFromJsonResponseTest { public void testApplyInputStream() { InputStream is = Strings2 .toInputStream("[ {\"name\":\"test_container_1\",\"count\":2,\"bytes\":78}, {\"name\":\"test_container_2\",\"count\":1,\"bytes\":17} ] "); - Map meta = new HashMap(); + Map meta = Maps.newHashMap(); List expects = ImmutableList.of(ContainerMetadata.builder().name("test_container_1").count( 2).bytes(78).metadata(meta).build(), ContainerMetadata.builder().name("test_container_2").count(1).bytes(17).metadata(meta).build()); diff --git a/blobstore/src/main/java/org/jclouds/blobstore/options/GetOptions.java b/blobstore/src/main/java/org/jclouds/blobstore/options/GetOptions.java index eb953d28b6..841af3ee93 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/options/GetOptions.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/options/GetOptions.java @@ -21,10 +21,11 @@ package org.jclouds.blobstore.options; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.ArrayList; import java.util.Date; import java.util.List; +import com.google.common.collect.Lists; + /** * Contains options supported for HTTP GET operations.

* Usage

The recommended way to instantiate a {@link GetOptions} object is to statically import @@ -46,7 +47,7 @@ public class GetOptions { public static final GetOptions NONE = new GetOptions(); - private final List ranges = new ArrayList(); + private final List ranges = Lists.newArrayList(); private Date ifModifiedSince; private Date ifUnmodifiedSince; private String ifMatch; diff --git a/blobstore/src/test/java/org/jclouds/blobstore/BlobStoresTest.java b/blobstore/src/test/java/org/jclouds/blobstore/BlobStoresTest.java index 29ea2b554c..b5803232e8 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/BlobStoresTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/BlobStoresTest.java @@ -21,7 +21,6 @@ package org.jclouds.blobstore; import static org.easymock.EasyMock.createMock; import static org.testng.Assert.assertEquals; -import java.util.HashSet; import java.util.Set; import org.easymock.EasyMock; @@ -37,6 +36,7 @@ import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; +import com.google.common.collect.Sets; @Test(singleThreaded = true, testName = "BlobStoresTest") public class BlobStoresTest { @@ -95,7 +95,7 @@ public class BlobStoresTest { try { blobStore = context.getBlobStore(); blobStore.createContainerInLocation(null, containerName); - Set expectedNames = new HashSet(); + Set expectedNames = Sets.newHashSet(); for (int i = 0; i < NUM_BLOBS; i++) { String blobName = "myname" + i; blobStore.putBlob(containerName, blobStore.blobBuilder(blobName).payload("payload" + i).build()); diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseInputStreamMapIntegrationTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseInputStreamMapIntegrationTest.java index 153a4118d1..7cbbb0bd9a 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseInputStreamMapIntegrationTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseInputStreamMapIntegrationTest.java @@ -25,7 +25,6 @@ import static org.testng.Assert.assertEquals; import java.io.IOException; import java.io.InputStream; import java.util.Collection; -import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -39,6 +38,7 @@ import org.jclouds.blobstore.options.ListContainerOptions; import org.jclouds.util.Strings2; import org.testng.annotations.Test; +import com.google.common.collect.Maps; import com.google.common.collect.Sets; /** @@ -80,7 +80,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati keySet.add(i + ""); } - Map newMap = new HashMap(); + Map newMap = Maps.newHashMap(); for (String key : keySet) { newMap.put(key, key); } diff --git a/common/aws/src/main/java/org/jclouds/aws/domain/AWSError.java b/common/aws/src/main/java/org/jclouds/aws/domain/AWSError.java index 8d55506545..905c8da5fd 100644 --- a/common/aws/src/main/java/org/jclouds/aws/domain/AWSError.java +++ b/common/aws/src/main/java/org/jclouds/aws/domain/AWSError.java @@ -18,9 +18,10 @@ */ package org.jclouds.aws.domain; -import java.util.HashMap; import java.util.Map; +import com.google.common.collect.Maps; + /** * When an Amazon S3 request is in error, the client receives an error response. * @@ -35,7 +36,7 @@ public class AWSError { private String message; private String requestId; private String requestToken; - private Map details = new HashMap(); + private Map details = Maps.newHashMap(); private String stringSigned; private String signature; diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java b/common/azure/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java index c82c807659..199b547c2a 100644 --- a/common/azure/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java +++ b/common/azure/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java @@ -22,7 +22,6 @@ import static org.jclouds.util.Patterns.NEWLINE_PATTERN; import java.util.Collection; import java.util.Set; -import java.util.TreeSet; import javax.annotation.Resource; import javax.inject.Inject; @@ -52,6 +51,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; import com.google.common.collect.Multimaps; +import com.google.common.collect.Sets; /** * Signs the Azure Storage request. @@ -153,7 +153,8 @@ public class SharedKeyLiteAuthentication implements HttpRequestFilter { } private void appendCanonicalizedHeaders(HttpRequest request, StringBuilder toSign) { - Set headers = new TreeSet(request.getHeaders().keySet()); + // TreeSet == Sort the headers alphabetically. + Set headers = Sets.newTreeSet(request.getHeaders().keySet()); for (String header : headers) { if (header.startsWith("x-ms-")) { toSign.append(header.toLowerCase()).append(":"); diff --git a/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java b/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java index f30c183302..3174c01039 100644 --- a/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java +++ b/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java @@ -46,7 +46,6 @@ import static org.testng.Assert.assertNotNull; import static org.testng.Assert.fail; import java.io.IOException; -import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; @@ -103,6 +102,7 @@ import com.google.common.base.Stopwatch; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import com.google.common.net.HostAndPort; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -420,8 +420,8 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte @Test(enabled = true, dependsOnMethods = "testCompareSizes") public void testConcurrentUseOfComputeServiceToCreateNodes() throws Exception { final long timeoutMs = 20 * 60 * 1000; - List groups = new ArrayList(); - List> futures = new ArrayList>(); + List groups = Lists.newArrayList(); + List> futures = Lists.newArrayList(); ListeningExecutorService executor = MoreExecutors.listeningDecorator(context.utils().userExecutor()); try { diff --git a/core/src/main/java/org/jclouds/ContextBuilder.java b/core/src/main/java/org/jclouds/ContextBuilder.java index 7a1e8c01f1..2867f450ed 100644 --- a/core/src/main/java/org/jclouds/ContextBuilder.java +++ b/core/src/main/java/org/jclouds/ContextBuilder.java @@ -33,7 +33,6 @@ import static com.google.common.collect.Lists.newArrayList; import static org.jclouds.Constants.*; import static org.jclouds.util.Throwables2.propagateAuthorizationOrOriginalException; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; @@ -79,6 +78,7 @@ import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.ImmutableMultimap.Builder; import com.google.common.reflect.TypeToken; @@ -157,7 +157,7 @@ public class ContextBuilder { protected String apiVersion; protected String buildVersion; protected Optional overrides = Optional.absent(); - protected List modules = new ArrayList(3); + protected List modules = Lists.newArrayListWithCapacity(3); @Override public String toString() { diff --git a/core/src/main/java/org/jclouds/apis/ApiRegistry.java b/core/src/main/java/org/jclouds/apis/ApiRegistry.java index 78071db153..409677330a 100644 --- a/core/src/main/java/org/jclouds/apis/ApiRegistry.java +++ b/core/src/main/java/org/jclouds/apis/ApiRegistry.java @@ -18,15 +18,16 @@ */ package org.jclouds.apis; -import java.util.HashSet; import java.util.Set; +import com.google.common.collect.Sets; + /** * A registry for holding {@link org.jclouds.apis.ApiMetadata}. */ public class ApiRegistry { - private static final Set apis = new HashSet(); + private static final Set apis = Sets.newHashSet(); public static void registerApi(ApiMetadata api) { apis.add(api); diff --git a/core/src/main/java/org/jclouds/http/options/GetOptions.java b/core/src/main/java/org/jclouds/http/options/GetOptions.java index 4215a1d0be..7c43557518 100644 --- a/core/src/main/java/org/jclouds/http/options/GetOptions.java +++ b/core/src/main/java/org/jclouds/http/options/GetOptions.java @@ -21,7 +21,6 @@ package org.jclouds.http.options; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -31,6 +30,7 @@ import org.jclouds.date.DateService; import org.jclouds.date.internal.SimpleDateFormatDateService; import com.google.common.base.Joiner; +import com.google.common.collect.Lists; import com.google.common.collect.Multimap; /** @@ -53,7 +53,7 @@ import com.google.common.collect.Multimap; public class GetOptions extends BaseHttpRequestOptions { private static final DateService dateService = new SimpleDateFormatDateService(); public static final GetOptions NONE = new GetOptions(); - private final List ranges = new ArrayList(); + private final List ranges = Lists.newArrayList(); @Override public Multimap buildRequestHeaders() { diff --git a/core/src/main/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactory.java b/core/src/main/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactory.java index c6628a63f6..743463fbe2 100644 --- a/core/src/main/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactory.java +++ b/core/src/main/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactory.java @@ -25,11 +25,11 @@ import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Type; -import java.util.LinkedHashMap; import java.util.Map; import org.jclouds.json.internal.NamingStrategies.ConstructorFieldNamingStrategy; +import com.google.common.collect.Maps; import com.google.gson.FieldNamingStrategy; import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; @@ -248,7 +248,7 @@ public final class DeserializationConstructorAndReflectiveTypeAdapterFactory imp @SuppressWarnings("unchecked") private Map getParameterReaders(Gson context, TypeToken declaring, Constructor constructor) { - Map result = new LinkedHashMap(); + Map result = Maps.newLinkedHashMap(); for (int index = 0; index < constructor.getGenericParameterTypes().length; index++) { Type parameterType = getTypeOfConstructorParameter(declaring, constructor, index); diff --git a/core/src/main/java/org/jclouds/lifecycle/BaseLifeCycle.java b/core/src/main/java/org/jclouds/lifecycle/BaseLifeCycle.java index af00d328ad..1314629eee 100644 --- a/core/src/main/java/org/jclouds/lifecycle/BaseLifeCycle.java +++ b/core/src/main/java/org/jclouds/lifecycle/BaseLifeCycle.java @@ -18,7 +18,6 @@ */ package org.jclouds.lifecycle; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutorService; @@ -28,6 +27,8 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.annotation.Resource; +import com.google.common.collect.Lists; + import org.jclouds.logging.Logger; /** @@ -47,7 +48,7 @@ public abstract class BaseLifeCycle implements Runnable, LifeCycle { public BaseLifeCycle(ExecutorService executor, LifeCycle... dependencies) { this.executorService = executor; - this.dependencies = new ArrayList(); + this.dependencies = Lists.newArrayList(); this.dependencies.addAll(Arrays.asList(dependencies)); this.statusLock = new Object(); this.status = Status.INACTIVE; diff --git a/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java b/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java index c91510423a..64a0a4d231 100644 --- a/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java +++ b/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java @@ -25,7 +25,6 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; -import java.util.HashSet; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.ScheduledExecutorService; @@ -39,6 +38,7 @@ import org.jclouds.concurrent.MoreExecutors; import org.jclouds.lifecycle.Closer; import com.google.common.base.Throwables; +import com.google.common.collect.Sets; import com.google.common.util.concurrent.ExecutionList; import com.google.inject.AbstractModule; import com.google.inject.Inject; @@ -103,7 +103,7 @@ public class LifeCycleModule extends AbstractModule { protected void bindPostInjectionInvoke(final Closer closer, final ExecutionList list) { bindListener(any(), new TypeListener() { public void hear(TypeLiteral injectableType, TypeEncounter encounter) { - Set methods = new HashSet(); + Set methods = Sets.newHashSet(); Class type = injectableType.getRawType(); while (type != null) { methods.addAll(Arrays.asList(type.getDeclaredMethods())); diff --git a/core/src/main/java/org/jclouds/logging/config/BindLoggersAnnotatedWithResource.java b/core/src/main/java/org/jclouds/logging/config/BindLoggersAnnotatedWithResource.java index 8801ebb035..1b8eae325c 100644 --- a/core/src/main/java/org/jclouds/logging/config/BindLoggersAnnotatedWithResource.java +++ b/core/src/main/java/org/jclouds/logging/config/BindLoggersAnnotatedWithResource.java @@ -23,7 +23,6 @@ import static com.google.common.collect.Sets.filter; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.util.Arrays; -import java.util.HashSet; import java.util.Set; import javax.annotation.Resource; @@ -35,6 +34,7 @@ import org.jclouds.logging.Logger.LoggerFactory; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Predicate; +import com.google.common.collect.Sets; import com.google.inject.ProvisionException; import com.google.inject.TypeLiteral; import com.google.inject.spi.InjectionListener; @@ -129,7 +129,7 @@ public class BindLoggersAnnotatedWithResource implements TypeListener { @VisibleForTesting Set getLoggerFieldsAnnotatedWithResource(Class declaredType) { - Set fields = new HashSet(); + Set fields = Sets.newHashSet(); Class type = declaredType; while (type != null) { fields.addAll(Arrays.asList(type.getDeclaredFields())); diff --git a/core/src/main/java/org/jclouds/providers/ProviderRegistry.java b/core/src/main/java/org/jclouds/providers/ProviderRegistry.java index b79741e0ec..d9bd784be3 100644 --- a/core/src/main/java/org/jclouds/providers/ProviderRegistry.java +++ b/core/src/main/java/org/jclouds/providers/ProviderRegistry.java @@ -18,15 +18,16 @@ */ package org.jclouds.providers; -import java.util.HashSet; import java.util.Set; +import com.google.common.collect.Sets; + /** * A registry for holding {@link org.jclouds.providers.ProviderMetadata}. */ public class ProviderRegistry { - private static final Set providers = new HashSet(); + private static final Set providers = Sets.newHashSet(); public static void registerProvider(ProviderMetadata provider) { providers.add(provider); diff --git a/core/src/main/java/org/jclouds/util/InputStreamChain.java b/core/src/main/java/org/jclouds/util/InputStreamChain.java index cbb56ee18f..deb2645d88 100644 --- a/core/src/main/java/org/jclouds/util/InputStreamChain.java +++ b/core/src/main/java/org/jclouds/util/InputStreamChain.java @@ -22,6 +22,8 @@ import java.io.IOException; import java.io.InputStream; import java.util.LinkedList; +import com.google.common.collect.Lists; + /** * {@link InputStream} implementation that allows chaining of various streams for seamless * sequential reading @@ -34,7 +36,7 @@ public class InputStreamChain extends InputStream { /** * Input stream chain */ - private final LinkedList streams = new LinkedList(); + private final LinkedList streams = Lists.newLinkedList(); /** * Currently active stream diff --git a/core/src/test/java/org/jclouds/ContextBuilderTest.java b/core/src/test/java/org/jclouds/ContextBuilderTest.java index a7b55ff3ae..8f8cc6a6c7 100644 --- a/core/src/test/java/org/jclouds/ContextBuilderTest.java +++ b/core/src/test/java/org/jclouds/ContextBuilderTest.java @@ -21,7 +21,6 @@ package org.jclouds; import static org.testng.Assert.assertEquals; import java.net.URI; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Properties; @@ -47,6 +46,7 @@ import org.testng.annotations.Test; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; import com.google.inject.AbstractModule; import com.google.inject.Binder; import com.google.inject.Key; @@ -130,7 +130,7 @@ public class ContextBuilderTest { @Test public void testAddHttpModuleIfNotPresent() { - List modules = new ArrayList(); + List modules = Lists.newArrayList(); HttpModule module = new HttpModule(); modules.add(module); ContextBuilder.addHttpModuleIfNeededAndNotPresent(modules); @@ -140,7 +140,7 @@ public class ContextBuilderTest { @Test public void testAddLoggingModuleIfNotPresent() { - List modules = new ArrayList(); + List modules = Lists.newArrayList(); LoggingModule module = new NullLoggingModule(); modules.add(module); ContextBuilder.addLoggingModuleIfNotPresent(modules); @@ -150,7 +150,7 @@ public class ContextBuilderTest { @Test public void testAddEventBusModuleIfNotPresent() { - List modules = new ArrayList(); + List modules = Lists.newArrayList(); EventBusModule module = new EventBusModule(); modules.add(module); ContextBuilder.addEventBusIfNotPresent(modules); @@ -160,7 +160,7 @@ public class ContextBuilderTest { @Test public void testAddExecutorServiceModuleIfNotPresent() { - List modules = new ArrayList(); + List modules = Lists.newArrayList(); ExecutorServiceModule module = new ExecutorServiceModule(); modules.add(module); ContextBuilder.addExecutorServiceIfNotPresent(modules); @@ -170,7 +170,7 @@ public class ContextBuilderTest { @Test public void testAddCredentialStoreModuleIfNotPresent() { - List modules = new ArrayList(); + List modules = Lists.newArrayList(); CredentialStoreModule module = new CredentialStoreModule(); modules.add(module); ContextBuilder.addCredentialStoreIfNotPresent(modules); @@ -180,7 +180,7 @@ public class ContextBuilderTest { @Test public void testAddNone() { - List modules = new ArrayList(); + List modules = Lists.newArrayList(); LoggingModule loggingModule = new NullLoggingModule(); modules.add(loggingModule); HttpModule httpModule = new HttpModule(); @@ -202,7 +202,7 @@ public class ContextBuilderTest { @Test public void testAddBothWhenDefault() { - List modules = new ArrayList(); + List modules = Lists.newArrayList(); ContextBuilder.addHttpModuleIfNeededAndNotPresent(modules); ContextBuilder.addLoggingModuleIfNotPresent(modules); assertEquals(modules.size(), 2); @@ -212,7 +212,7 @@ public class ContextBuilderTest { @Test public void testAddBothWhenLive() { - List modules = new ArrayList(); + List modules = Lists.newArrayList(); ContextBuilder.addHttpModuleIfNeededAndNotPresent(modules); ContextBuilder.addLoggingModuleIfNotPresent(modules); assertEquals(modules.size(), 2); diff --git a/core/src/test/java/org/jclouds/date/DateServiceTest.java b/core/src/test/java/org/jclouds/date/DateServiceTest.java index ba0b74f161..8ad70ab51d 100644 --- a/core/src/test/java/org/jclouds/date/DateServiceTest.java +++ b/core/src/test/java/org/jclouds/date/DateServiceTest.java @@ -20,7 +20,6 @@ package org.jclouds.date; import static org.testng.Assert.assertEquals; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -28,6 +27,7 @@ import org.jclouds.PerformanceTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; +import com.google.common.collect.Lists; import com.google.inject.Guice; import com.google.inject.Injector; @@ -205,7 +205,7 @@ public class DateServiceTest extends PerformanceTest { @Test void testFormatIso8601DateCorrectnessInParallel() throws Throwable { - List tasks = new ArrayList(testData.length); + List tasks = Lists.newArrayListWithCapacity(testData.length); for (final TestData myData : testData) { tasks.add(new Runnable() { public void run() { @@ -219,7 +219,7 @@ public class DateServiceTest extends PerformanceTest { @Test void testFormatIso8601DatePerformanceInParallel() throws Throwable { - List tasks = new ArrayList(testData.length); + List tasks = Lists.newArrayListWithCapacity(testData.length); for (final TestData myData : testData) { tasks.add(new Runnable() { public void run() { @@ -238,7 +238,7 @@ public class DateServiceTest extends PerformanceTest { @Test void testParseIso8601DateCorrectnessInParallel() throws Throwable { - List tasks = new ArrayList(testData.length); + List tasks = Lists.newArrayListWithCapacity(testData.length); for (final TestData myData : testData) { tasks.add(new Runnable() { public void run() { @@ -252,7 +252,7 @@ public class DateServiceTest extends PerformanceTest { @Test void testParseIso8601DatePerformanceInParallel() throws Throwable { - List tasks = new ArrayList(testData.length); + List tasks = Lists.newArrayListWithCapacity(testData.length); for (final TestData myData : testData) { tasks.add(new Runnable() { public void run() { diff --git a/core/src/test/java/org/jclouds/json/GsonExperimentsTest.java b/core/src/test/java/org/jclouds/json/GsonExperimentsTest.java index 4f8493c664..ea974ee888 100644 --- a/core/src/test/java/org/jclouds/json/GsonExperimentsTest.java +++ b/core/src/test/java/org/jclouds/json/GsonExperimentsTest.java @@ -25,7 +25,6 @@ import java.io.IOException; import java.io.StringReader; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; -import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -34,6 +33,7 @@ import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.common.base.Optional; +import com.google.common.collect.Lists; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; @@ -75,7 +75,7 @@ public class GsonExperimentsTest { @BeforeTest void setupSource() { gson = new Gson(); - Collection collection = new ArrayList(); + Collection collection = Lists.newArrayList(); collection.add("hello"); collection.add(5); collection.add(new Event("GREETINGS", "guest")); diff --git a/core/src/test/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactoryTest.java b/core/src/test/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactoryTest.java index 478a3f1b17..18909c413f 100644 --- a/core/src/test/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactoryTest.java +++ b/core/src/test/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactoryTest.java @@ -26,8 +26,6 @@ import static org.testng.Assert.fail; import java.beans.ConstructorProperties; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,6 +39,8 @@ import org.testng.annotations.Test; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import com.google.gson.FieldNamingStrategy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -188,8 +188,8 @@ public final class DeserializationConstructorAndReflectiveTypeAdapterFactoryTest @Inject GenericParamsCopiedIn(@Named("foo") List foo, @Named("bar") Map bar) { - this.foo = new ArrayList(foo); - this.bar = new HashMap(bar); + this.foo = Lists.newArrayList(foo); + this.bar = Maps.newHashMap(bar); } } @@ -197,9 +197,9 @@ public final class DeserializationConstructorAndReflectiveTypeAdapterFactoryTest public void testGenericParamsCopiedIn() throws IOException { TypeAdapter adapter = parameterizedCtorFactory.create(gson, TypeToken .get(GenericParamsCopiedIn.class)); - List inputFoo = new ArrayList(); + List inputFoo = Lists.newArrayList(); inputFoo.add("one"); - HashMap inputBar = new HashMap(); + Map inputBar = Maps.newHashMap(); inputBar.put("2", "two"); GenericParamsCopiedIn toTest = adapter.fromJson("{ \"foo\":[\"one\"], \"bar\":{ \"2\":\"two\"}}"); diff --git a/core/src/test/java/org/jclouds/predicates/RetryablePredicateTest.java b/core/src/test/java/org/jclouds/predicates/RetryablePredicateTest.java index 8eb539ebde..ba18296025 100644 --- a/core/src/test/java/org/jclouds/predicates/RetryablePredicateTest.java +++ b/core/src/test/java/org/jclouds/predicates/RetryablePredicateTest.java @@ -20,7 +20,6 @@ package org.jclouds.predicates; import static org.testng.Assert.fail; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutionException; @@ -35,6 +34,7 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.base.Stopwatch; import com.google.common.base.Supplier; +import com.google.common.collect.Lists; /** * @@ -160,7 +160,7 @@ public class RetryablePredicateTest { } public static class RepeatedAttemptsPredicate implements Predicate { - final List callTimes = new ArrayList(); + final List callTimes = Lists.newArrayList(); private final int succeedOnAttempt; private final Stopwatch stopwatch; private int count = 0; diff --git a/drivers/gae/src/test/java/org/jclouds/gae/ConvertToJcloudsResponseTest.java b/drivers/gae/src/test/java/org/jclouds/gae/ConvertToJcloudsResponseTest.java index 4a43e8a3dd..9a308026a2 100644 --- a/drivers/gae/src/test/java/org/jclouds/gae/ConvertToJcloudsResponseTest.java +++ b/drivers/gae/src/test/java/org/jclouds/gae/ConvertToJcloudsResponseTest.java @@ -27,7 +27,6 @@ import java.io.IOException; import java.net.URI; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; -import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.HttpHeaders; @@ -47,6 +46,7 @@ import org.testng.annotations.Test; import com.google.appengine.api.urlfetch.HTTPHeader; import com.google.appengine.api.urlfetch.HTTPResponse; import com.google.common.base.Throwables; +import com.google.common.collect.Lists; /** * @@ -85,7 +85,7 @@ public class ConvertToJcloudsResponseTest { void testConvertWithHeaders() throws IOException { HTTPResponse gaeResponse = createMock(HTTPResponse.class); expect(gaeResponse.getResponseCode()).andReturn(200); - List headers = new ArrayList(); + List headers = Lists.newArrayList(); headers.add(new HTTPHeader(HttpHeaders.CONTENT_TYPE, "text/xml")); expect(gaeResponse.getHeaders()).andReturn(headers); expect(gaeResponse.getContent()).andReturn(null).atLeastOnce(); @@ -100,7 +100,7 @@ public class ConvertToJcloudsResponseTest { void testConvertWithContent() throws IOException { HTTPResponse gaeResponse = createMock(HTTPResponse.class); expect(gaeResponse.getResponseCode()).andReturn(200); - List headers = new ArrayList(); + List headers = Lists.newArrayList(); headers.add(new HTTPHeader(HttpHeaders.CONTENT_TYPE, "text/xml")); expect(gaeResponse.getHeaders()).andReturn(headers); expect(gaeResponse.getContent()).andReturn("hello".getBytes()).atLeastOnce(); diff --git a/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientLiveTest.java b/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientLiveTest.java index 0ea418a8bc..9b87cafa32 100644 --- a/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientLiveTest.java +++ b/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientLiveTest.java @@ -30,7 +30,6 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintStream; import java.net.InetAddress; -import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.Executors; @@ -51,6 +50,7 @@ import org.testng.annotations.Test; import com.google.common.base.Charsets; import com.google.common.base.Strings; import com.google.common.base.Suppliers; +import com.google.common.collect.Lists; import com.google.common.io.Closeables; import com.google.common.io.Files; import com.google.common.net.HostAndPort; @@ -236,7 +236,7 @@ public class JschSshClientLiveTest { public void testExecHostnameConcurrentlyWithSameSessions() throws Exception { final SshClient client = setupClient(); ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10)); - List> futures = new ArrayList>(); + List> futures = Lists.newArrayList(); try { for (int i = 0; i < 100; i++) { futures.add(executor.submit(new Callable() { diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWrapper.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWrapper.java index baca65bc4a..f22fec7a6d 100644 --- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWrapper.java +++ b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWrapper.java @@ -24,7 +24,6 @@ import static com.google.common.collect.Iterables.transform; import java.lang.reflect.Constructor; import java.net.URI; -import java.util.ArrayList; import java.util.List; import org.jclouds.abiquo.AbiquoApi; @@ -199,7 +198,7 @@ public abstract class DomainWrapper { * @return The async task array. */ protected AsyncTask[] getTasks(final AcceptedRequestDto acceptedRequest) { - List tasks = new ArrayList(); + List tasks = Lists.newArrayList(); for (RESTLink link : acceptedRequest.getLinks()) { // This will return null on untrackable tasks diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/User.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/User.java index 04a2fb6fdd..59035f8983 100644 --- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/User.java +++ b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/User.java @@ -22,7 +22,6 @@ package org.jclouds.abiquo.domain.enterprise; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.Iterables.filter; -import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; @@ -155,7 +154,7 @@ public class User extends DomainWrapper { * List of virtual datacenters from the user's enterprise. */ public void setPermittedVirtualDatacenters(final List vdcs) { - List ids = new ArrayList(); + List ids = Lists.newArrayList(); for (VirtualDatacenter vdc : vdcs) { checkNotNull(vdc.getId(), ValidationErrors.MISSING_REQUIRED_FIELD + " id in " + VirtualDatacenter.class); diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/EnterpriseResources.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/EnterpriseResources.java index 4b32b0aced..c38a9f596b 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/EnterpriseResources.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/EnterpriseResources.java @@ -21,7 +21,6 @@ package org.jclouds.abiquo.domain; import static org.jclouds.abiquo.domain.DomainUtils.link; -import java.util.HashMap; import java.util.Map; import com.abiquo.model.rest.RESTLink; @@ -30,6 +29,7 @@ import com.abiquo.server.core.enterprise.DatacenterLimitsDto; import com.abiquo.server.core.enterprise.EnterpriseDto; import com.abiquo.server.core.enterprise.EnterprisePropertiesDto; import com.abiquo.server.core.enterprise.UserDto; +import com.google.common.collect.Maps; /** * Enterprise domain utilities. @@ -71,7 +71,7 @@ public class EnterpriseResources { public static EnterprisePropertiesDto enterprisePropertiesPut() { EnterprisePropertiesDto enterpriseProp = new EnterprisePropertiesDto(); enterpriseProp.setId(1); - Map props = new HashMap(); + Map props = Maps.newHashMap(); props.put("key", "value"); enterpriseProp.setProperties(props); enterpriseProp.addLink(new RESTLink("edit", "http://localhost/api/admin/enterprises/1/properties")); diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveApiTest.java index 7f70c00a81..5ca524d308 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveApiTest.java @@ -24,7 +24,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; -import java.util.ArrayList; import java.util.List; import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest; @@ -32,6 +31,7 @@ import org.testng.annotations.Test; import com.abiquo.server.core.cloud.VirtualApplianceDto; import com.abiquo.server.core.cloud.VirtualApplianceState; +import com.google.common.collect.Lists; /** * Live integration tests for the {@link VirtualAppliance} domain class. @@ -69,7 +69,7 @@ public class VirtualApplianceLiveApiTest extends BaseAbiquoApiLiveApiTest { } public void testListVirtualMachinesReturnsAll() { - List vms = new ArrayList(); + List vms = Lists.newArrayList(); // Pagination by default is set to 25 items per page, so create a few more // to verify that diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/config/CostCodeLiveApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/config/CostCodeLiveApiTest.java index 1de82a9386..3701f7c537 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/config/CostCodeLiveApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/domain/config/CostCodeLiveApiTest.java @@ -26,11 +26,12 @@ import static org.testng.Assert.assertNotNull; import static org.testng.Assert.fail; import java.math.BigDecimal; -import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.Response.Status; +import com.google.common.collect.Lists; + import org.jclouds.abiquo.domain.exception.AbiquoException; import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest; import org.jclouds.abiquo.predicates.config.PricingPredicates; @@ -99,7 +100,7 @@ public class CostCodeLiveApiTest extends BaseAbiquoApiLiveApiTest { .description("description").build(); costcodeprice = new CostCodePrice(currency, new BigDecimal(100)); - this.defaultPrices = new ArrayList(); + this.defaultPrices = Lists.newArrayList(); defaultPrices.add(costcodeprice); costcode2.setDefaultPrices(defaultPrices); // When a cost code is created it is also created a costcodecurrency with diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/strategy/cloud/ListVirtualMachinesLiveApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/strategy/cloud/ListVirtualMachinesLiveApiTest.java index 1d80fc5e97..9b4cc3e4f1 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/strategy/cloud/ListVirtualMachinesLiveApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/strategy/cloud/ListVirtualMachinesLiveApiTest.java @@ -24,9 +24,10 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; -import java.util.ArrayList; import java.util.List; +import com.google.common.collect.Lists; + import org.jclouds.abiquo.domain.cloud.VirtualMachine; import org.jclouds.abiquo.predicates.cloud.VirtualMachinePredicates; import org.jclouds.abiquo.strategy.BaseAbiquoStrategyLiveApiTest; @@ -69,7 +70,7 @@ public class ListVirtualMachinesLiveApiTest extends BaseAbiquoStrategyLiveApiTes } public void testExecuteWhenExceedsPagination() { - List vms = new ArrayList(); + List vms = Lists.newArrayList(); // Pagination by default is set to 25 items per page, so create a few more // to verify that diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentParams.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentParams.java index 0a6e7d299d..9215f606f1 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentParams.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentParams.java @@ -1,10 +1,10 @@ package org.jclouds.azure.management.domain; -import java.util.ArrayList; import java.util.List; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; +import com.google.common.collect.Lists; /** * @@ -34,7 +34,7 @@ public class DeploymentParams { protected String storageAccount; protected OSType osType; protected RoleSize size = RoleSize.SMALL; - protected List endpoints = new ArrayList(); + protected List endpoints = Lists.newArrayList(); public Builder name(String name) { this.name = name; diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/hostedservice/CreateDeployment.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/hostedservice/CreateDeployment.java index d815617883..9b826f2685 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/hostedservice/CreateDeployment.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/hostedservice/CreateDeployment.java @@ -1,12 +1,13 @@ package org.jclouds.azure.management.domain.hostedservice; -import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; +import com.google.common.collect.Lists; + @XmlRootElement(name = "CreateDeployment") public class CreateDeployment { @@ -65,7 +66,7 @@ public class CreateDeployment { @XmlElementWrapper(name = "ExtendedProperties") @XmlElement(required = true, name = "ExtendedProperty") - private List extendedProperties = new ArrayList(); + private List extendedProperties = Lists.newArrayList(); public CreateDeployment() { } diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/AbstractRole.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/AbstractRole.java index da9dee3bf1..92216fdc69 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/AbstractRole.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/AbstractRole.java @@ -1,11 +1,12 @@ package org.jclouds.azure.management.domain.role; -import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; +import com.google.common.collect.Lists; + import org.jclouds.azure.management.domain.role.conf.ConfigurationSet; //@XmlRootElement(name = "PersistentVMRole") @@ -32,7 +33,7 @@ public abstract class AbstractRole { */ @XmlElementWrapper(name = "ConfigurationSets") @XmlElement(name = "ConfigurationSet") - private List configurationSets = new ArrayList(0); + private List configurationSets = Lists.newArrayListWithCapacity(0); /** * Specifies the name of an availability set to which to add the virtual machine. This value @@ -45,7 +46,7 @@ public abstract class AbstractRole { @XmlElementWrapper(name = "DataVirtualHardDisks") @XmlElement(name = "DataVirtualHardDisk") - private List dataVirtualHardDisks = new ArrayList(0); + private List dataVirtualHardDisks = Lists.newArrayListWithCapacity(0); @XmlElement(name = "OSVirtualHardDisk") private OSVirtualHardDisk osVirtualHardDisk; diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/DNS.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/DNS.java index 767a8c3218..fdaec370e3 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/DNS.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/DNS.java @@ -1,12 +1,13 @@ package org.jclouds.azure.management.domain.role; -import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; +import com.google.common.collect.Lists; + @XmlRootElement(name = "Dns") public class DNS { /** @@ -14,7 +15,7 @@ public class DNS { */ @XmlElementWrapper(required = true, name = "DnsServers") @XmlElement(name = "DnsServer") - private List dnsServers = new ArrayList(); + private List dnsServers = Lists.newArrayList(); public DNS() { super(); diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/Deployment.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/Deployment.java index 99e8e64553..2ce2973f32 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/Deployment.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/Deployment.java @@ -1,12 +1,13 @@ package org.jclouds.azure.management.domain.role; -import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; +import com.google.common.collect.Lists; + @XmlRootElement(name = "Deployment") public class Deployment { @@ -37,7 +38,7 @@ public class Deployment { @XmlElementWrapper(required = true, name = "RoleList") @XmlElement(required = true, name = "Role") - private List roleList = new ArrayList(); + private List roleList = Lists.newArrayList(); /** * Specifies the name of an existing virtual network to which the deployment will belong. diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/ConfigurationSetAdapter.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/ConfigurationSetAdapter.java index 2d3b5f8de7..64c1e01234 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/ConfigurationSetAdapter.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/ConfigurationSetAdapter.java @@ -1,6 +1,5 @@ package org.jclouds.azure.management.domain.role.conf; -import java.util.ArrayList; import java.util.List; import java.util.TimeZone; @@ -8,6 +7,8 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.adapters.XmlAdapter; +import com.google.common.collect.Lists; + public class ConfigurationSetAdapter extends XmlAdapter { @@ -119,15 +120,15 @@ public class ConfigurationSetAdapter extends @XmlElementWrapper(required = true, name = "StoredCertificateSettings") @XmlElement(name = "CertificateSetting") - public List storedCertificateSettings = new ArrayList(); + public List storedCertificateSettings = Lists.newArrayList(); @XmlElementWrapper(name = "InputEndpoints") @XmlElement(name = "InputEndpoint") - public List inputEndpoints = new ArrayList(0); + public List inputEndpoints = Lists.newArrayListWithCapacity(0); @XmlElementWrapper(name = "SubnetNames") @XmlElement(name = "SubnetName") - public List subnetNames = new ArrayList(0); + public List subnetNames = Lists.newArrayListWithCapacity(0); } } diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/NetworkConfiguration.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/NetworkConfiguration.java index 19ab48b5a3..66cd310228 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/NetworkConfiguration.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/NetworkConfiguration.java @@ -1,8 +1,9 @@ package org.jclouds.azure.management.domain.role.conf; -import java.util.ArrayList; import java.util.List; +import com.google.common.collect.Lists; + //@XmlRootElement(name = "ConfigurationSet") public class NetworkConfiguration extends ConfigurationSet { @@ -13,14 +14,14 @@ public class NetworkConfiguration extends ConfigurationSet { */ // @XmlElementWrapper(name = "InputEndpoints") // @XmlElement(name = "InputEndpoint") - private List inputEndpoints = new ArrayList(0); + private List inputEndpoints = Lists.newArrayListWithCapacity(0); /** * Specifies the name of a subnet to which the virtual machine belongs. */ // @XmlElementWrapper(name = "SubnetNames") // @XmlElement(name = "SubnetName") - private List subnetNames = new ArrayList(0); + private List subnetNames = Lists.newArrayListWithCapacity(0); public NetworkConfiguration() { setConfigurationSetType(ID); diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/SSH.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/SSH.java index 4e26587ed1..b40ec701a0 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/SSH.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/SSH.java @@ -1,12 +1,13 @@ package org.jclouds.azure.management.domain.role.conf; -import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; +import com.google.common.collect.Lists; + @XmlRootElement(name = "SSH") public class SSH { @@ -15,14 +16,14 @@ public class SSH { */ @XmlElementWrapper(name = "PublicKeys") @XmlElement(name = "PublicKey") - private List publicKeys = new ArrayList(0); + private List publicKeys = Lists.newArrayListWithCapacity(0); /** * Specifies the public key. */ @XmlElementWrapper(name = "KeyPairs") @XmlElement(name = "KeyPair") - private List keyPairs = new ArrayList(0); + private List keyPairs = Lists.newArrayListWithCapacity(0); public SSH() { } diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/WindowsProvisioningConfiguration.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/WindowsProvisioningConfiguration.java index 8ade7188ad..ab33232d69 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/WindowsProvisioningConfiguration.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/WindowsProvisioningConfiguration.java @@ -1,9 +1,10 @@ package org.jclouds.azure.management.domain.role.conf; -import java.util.ArrayList; import java.util.List; import java.util.TimeZone; +import com.google.common.collect.Lists; + //@XmlRootElement(name = "ConfigurationSet") public class WindowsProvisioningConfiguration extends ConfigurationSet { @@ -50,7 +51,7 @@ public class WindowsProvisioningConfiguration extends ConfigurationSet { */ // @XmlElementWrapper(required = true, name = "StoredCertificateSettings") // @XmlElement(name = "CertificateSetting") - private List storedCertificateSettings = new ArrayList(); + private List storedCertificateSettings = Lists.newArrayList(); public WindowsProvisioningConfiguration() { diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/xml/DeploymentHandler.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/xml/DeploymentHandler.java index aaa3db5a9c..ccc8b532a8 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/xml/DeploymentHandler.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/xml/DeploymentHandler.java @@ -22,9 +22,10 @@ import static org.jclouds.util.SaxUtils.currentOrNull; import static org.jclouds.util.SaxUtils.equalsOrSuffix; import java.net.URI; -import java.util.ArrayList; import java.util.List; +import com.google.common.collect.Lists; + import org.jclouds.azure.management.domain.Deployment; import org.jclouds.azure.management.domain.DeploymentSlot; import org.jclouds.azure.management.domain.DeploymentStatus; @@ -42,7 +43,7 @@ import org.xml.sax.SAXException; public class DeploymentHandler extends ParseSax.HandlerForGeneratedRequestWithResult { - private List elements = new ArrayList(); + private List elements = Lists.newArrayList(); protected StringBuilder currentText = new StringBuilder(); private Deployment.Builder builder = Deployment.builder(); diff --git a/labs/cdmi/src/main/java/org/jclouds/snia/cdmi/v1/domain/CDMIObject.java b/labs/cdmi/src/main/java/org/jclouds/snia/cdmi/v1/domain/CDMIObject.java index 2351374363..e769cd56e5 100644 --- a/labs/cdmi/src/main/java/org/jclouds/snia/cdmi/v1/domain/CDMIObject.java +++ b/labs/cdmi/src/main/java/org/jclouds/snia/cdmi/v1/domain/CDMIObject.java @@ -21,8 +21,6 @@ package org.jclouds.snia.cdmi.v1.domain; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -33,6 +31,7 @@ import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; /** @@ -190,9 +189,9 @@ public class CDMIObject { * */ private void parseMetadata() { - userMetaDataIn = new HashMap(); - systemMetaDataIn = new HashMap(); - aclMetaDataIn = new ArrayList>(); + userMetaDataIn = Maps.newHashMap(); + systemMetaDataIn = Maps.newHashMap(); + aclMetaDataIn = Lists.newArrayList(); Iterator keys = metadata.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); @@ -203,7 +202,7 @@ public class CDMIObject { for (int i = 0; i < cdmi_acl_array.length; i++) { if (!(cdmi_acl_array[i].startsWith("[") || cdmi_acl_array[i].startsWith("]") || cdmi_acl_array[i] .startsWith(","))) { - HashMap aclMap = new HashMap(); + Map aclMap = Maps.newHashMap(); String[] cdmi_acl_member = cdmi_acl_array[i].split(","); for (String s : cdmi_acl_member) { String cdmi_acl_key = s.substring(0, s.indexOf(":")); diff --git a/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/ContainerApiLiveTest.java b/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/ContainerApiLiveTest.java index 7ad4537acc..f456388fa4 100644 --- a/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/ContainerApiLiveTest.java +++ b/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/ContainerApiLiveTest.java @@ -21,12 +21,13 @@ package org.jclouds.snia.cdmi.v1.features; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.logging.Logger; +import com.google.common.collect.Maps; + import org.jclouds.domain.JsonBall; import org.jclouds.snia.cdmi.v1.ObjectTypes; import org.jclouds.snia.cdmi.v1.domain.Container; @@ -46,7 +47,7 @@ public class ContainerApiLiveTest extends BaseCDMIApiLiveTest { @Test public void testCreateContainer() throws Exception { String pContainerName = "MyContainer" + System.currentTimeMillis() + "/"; - Map pContainerMetaDataIn = new HashMap(); + Map pContainerMetaDataIn = Maps.newHashMap(); Iterator keys; pContainerMetaDataIn.put("containerkey1", "value1"); pContainerMetaDataIn.put("containerkey2", "value2"); @@ -134,7 +135,7 @@ public class ContainerApiLiveTest extends BaseCDMIApiLiveTest { @Test public void testGetContainer() throws Exception { String pContainerName = "MyContainer" + System.currentTimeMillis() + "/"; - Map pContainerMetaDataIn = new HashMap(); + Map pContainerMetaDataIn = Maps.newHashMap(); Iterator keys; pContainerMetaDataIn.put("containerkey1", "value1"); pContainerMetaDataIn.put("containerkey2", "value2"); diff --git a/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/DataApiLiveTest.java b/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/DataApiLiveTest.java index b726446016..98c5c575a9 100644 --- a/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/DataApiLiveTest.java +++ b/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/DataApiLiveTest.java @@ -27,9 +27,7 @@ import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedHashMap; import java.util.Map; import java.util.logging.Logger; @@ -42,6 +40,7 @@ import org.jclouds.snia.cdmi.v1.queryparams.DataObjectQueryParams; import org.testng.annotations.Test; import com.google.common.base.Charsets; +import com.google.common.collect.Maps; import com.google.common.io.CharStreams; import com.google.common.io.Files; @@ -69,8 +68,8 @@ public class DataApiLiveTest extends BaseCDMIApiLiveTest { DataObject dataObject; Iterator keys; Map dataObjectMetaDataOut; - Map pContainerMetaDataIn = new HashMap(); - Map pDataObjectMetaDataIn = new LinkedHashMap(); + Map pContainerMetaDataIn = Maps.newHashMap(); + Map pDataObjectMetaDataIn = Maps.newLinkedHashMap(); pDataObjectMetaDataIn.put("dataObjectkey1", "value1"); pDataObjectMetaDataIn.put("dataObjectkey2", "value2"); pDataObjectMetaDataIn.put("dataObjectkey3", "value3"); @@ -487,8 +486,8 @@ public class DataApiLiveTest extends BaseCDMIApiLiveTest { DataObject dataObject; Iterator keys; Map dataObjectMetaDataOut; - Map pContainerMetaDataIn = new HashMap(); - Map pDataObjectMetaDataIn = new LinkedHashMap(); + Map pContainerMetaDataIn = Maps.newHashMap(); + Map pDataObjectMetaDataIn = Maps.newLinkedHashMap(); pDataObjectMetaDataIn.put("dataObjectkey1", "value1"); pDataObjectMetaDataIn.put("dataObjectkey2", "value2"); pDataObjectMetaDataIn.put("dataObjectkey3", "value3"); diff --git a/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/DataNonCDMIContentTypeApiLiveTest.java b/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/DataNonCDMIContentTypeApiLiveTest.java index a1fb7a5fc2..5495926c5c 100644 --- a/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/DataNonCDMIContentTypeApiLiveTest.java +++ b/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/features/DataNonCDMIContentTypeApiLiveTest.java @@ -26,8 +26,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.Map; import java.util.logging.Logger; @@ -46,6 +44,7 @@ import org.jclouds.util.Strings2; import org.testng.annotations.Test; import com.google.common.base.Charsets; +import com.google.common.collect.Maps; import com.google.common.io.CharStreams; import com.google.common.io.Files; import com.google.common.net.MediaType; @@ -68,8 +67,8 @@ public class DataNonCDMIContentTypeApiLiveTest extends BaseCDMIApiLiveTest { Files.touch(tmpFileIn); byte[] bytes; DataObject dataObject; - Map pContainerMetaDataIn = new HashMap(); - Map pDataObjectMetaDataIn = new LinkedHashMap(); + Map pContainerMetaDataIn = Maps.newHashMap(); + Map pDataObjectMetaDataIn = Maps.newLinkedHashMap(); pDataObjectMetaDataIn.put("dataObjectkey1", "value1"); pDataObjectMetaDataIn.put("dataObjectkey2", "value2"); pDataObjectMetaDataIn.put("dataObjectkey3", "value3"); diff --git a/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimReference.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimReference.java index 9276c89c53..88689b912d 100644 --- a/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimReference.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimReference.java @@ -20,8 +20,6 @@ package org.jclouds.dmtf.cim; import static org.jclouds.dmtf.DMTFConstants.CIM_NS; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -30,6 +28,9 @@ import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + /** * Java class for cimReference complex type. * @@ -43,7 +44,7 @@ public class CimReference { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute - private Map otherAttributes = new HashMap(); + private Map otherAttributes = Maps.newHashMap(); /** * Gets the value of the any property. @@ -70,7 +71,7 @@ public class CimReference { */ public List getAny() { if (any == null) { - any = new ArrayList(); + any = Lists.newArrayList(); } return this.any; } diff --git a/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Item.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Item.java index ae3e15e13e..efff81d1d5 100644 --- a/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Item.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Item.java @@ -20,7 +20,6 @@ package org.jclouds.dmtf.ovf; import static com.google.common.base.Objects.equal; -import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAnyAttribute; @@ -31,6 +30,7 @@ import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import com.google.common.base.Objects; +import com.google.common.collect.Maps; /** * Java class for anonymous complex type. @@ -78,7 +78,7 @@ public class Item { @XmlAttribute protected String stopAction; @XmlAnyAttribute - private Map otherAttributes = new HashMap(); + private Map otherAttributes = Maps.newHashMap(); /** * Gets the value of the id property. diff --git a/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/Property.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/Property.java index 0b06dc05d4..021d569f8e 100644 --- a/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/Property.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/Property.java @@ -20,9 +20,10 @@ package org.jclouds.dmtf.ovf.environment; import static org.jclouds.dmtf.DMTFConstants.OVF_ENV_NS; -import java.util.HashMap; import java.util.Map; +import com.google.common.collect.Maps; + import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; @@ -39,7 +40,7 @@ public class Property { @XmlAttribute(namespace = OVF_ENV_NS, required = true) protected String value; @XmlAnyAttribute - private Map otherAttributes = new HashMap(); + private Map otherAttributes = Maps.newHashMap(); /** * Gets the value of the key property. diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/functions/VServerMetadataToNodeMetadata.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/functions/VServerMetadataToNodeMetadata.java index 3da3d3e9dd..84a0c79c1a 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/functions/VServerMetadataToNodeMetadata.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/functions/VServerMetadataToNodeMetadata.java @@ -20,7 +20,6 @@ package org.jclouds.fujitsu.fgcp.compute.functions; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; @@ -53,6 +52,7 @@ import com.google.common.base.Supplier; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; /** * @author Dies Koper @@ -228,7 +228,7 @@ public class VServerMetadataToNodeMetadata implements VServerWithVNICs server = (VServerWithVNICs) from.getServer(); builder.location(parseLocation(server)); - List ips = new ArrayList(); + List ips = Lists.newArrayList(); if (server.getVnics() != null && server.getVnics().iterator().next().getPrivateIp() != null) { ips.add(server.getVnics().iterator().next().getPrivateIp()); } diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/strategy/FGCPComputeServiceAdapter.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/strategy/FGCPComputeServiceAdapter.java index ef989c5254..53184f344a 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/strategy/FGCPComputeServiceAdapter.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/strategy/FGCPComputeServiceAdapter.java @@ -20,7 +20,6 @@ package org.jclouds.fujitsu.fgcp.compute.strategy; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.ExecutionException; @@ -57,6 +56,7 @@ import org.jclouds.predicates.RetryablePredicate; import com.google.common.base.Predicate; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -172,7 +172,7 @@ public class FGCPComputeServiceAdapter implements Builder builder = VServerMetadata.builder(); builder.id(id); - List> futures = new ArrayList>(); + List> futures = Lists.newArrayList(); futures.add(asyncApi.getVirtualServerApi().getDetails(id)); futures.add(asyncApi.getVirtualServerApi().getStatus(id)); @@ -216,7 +216,7 @@ public class FGCPComputeServiceAdapter implements . builder(); Set systems = api.getVirtualDCApi().listVirtualSystems(); - List> futures = new ArrayList>(); + List> futures = Lists.newArrayList(); for (VSystem system : systems) { futures.add(asyncApi.getVirtualSystemApi().getDetails( diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Direction.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Direction.java index b76ad1db9f..5b825b261a 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Direction.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Direction.java @@ -18,11 +18,11 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Grouping of firewall rules pertaining to a particular direction in network @@ -34,7 +34,7 @@ import com.google.common.collect.ImmutableSet; public class Direction { private String from; private String to; - private Set policies = new LinkedHashSet(); + private Set policies = Sets.newLinkedHashSet(); private Acceptable acceptable; private Prefix prefix; private int maxPolicyNum; diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/DiskImage.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/DiskImage.java index 6540f357ff..f4a5e09040 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/DiskImage.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/DiskImage.java @@ -18,7 +18,6 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -27,6 +26,7 @@ import javax.xml.bind.annotation.XmlRootElement; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Represents a disk image with pre-installed OS and/or software. @@ -59,7 +59,7 @@ public class DiskImage { @XmlElementWrapper(name = "softwares") @XmlElement(name = "software") - private Set software = new LinkedHashSet(); + private Set software = Sets.newLinkedHashSet(); public String getId() { return id; diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/ErrorStatistics.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/ErrorStatistics.java index d5764097af..56b403eeaf 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/ErrorStatistics.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/ErrorStatistics.java @@ -18,12 +18,12 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlRootElement; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Holds statistics of errors reported by a load balancer (SLB). @@ -33,7 +33,7 @@ import com.google.common.collect.ImmutableSet; @XmlRootElement(name = "errorstatistics") public class ErrorStatistics { private Period period; - private Set groups = new LinkedHashSet(); + private Set groups = Sets.newLinkedHashSet(); /** * @return the period diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Firewall.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Firewall.java index 26f1c7efd0..e419ffc2f7 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Firewall.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Firewall.java @@ -18,12 +18,12 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlRootElement; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Represents a firewall (FW). @@ -33,7 +33,7 @@ import com.google.common.collect.ImmutableSet; @XmlRootElement(name = "fw") public class Firewall { private NAT nat; - private Set directions = new LinkedHashSet(); + private Set directions = Sets.newLinkedHashSet(); private String log; private String status; private String category; diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Group.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Group.java index 38392855ac..3eb86801ab 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Group.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Group.java @@ -18,13 +18,13 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlEnumValue; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Describes attributes of a software load balancer's (SLB) configuration. @@ -62,7 +62,7 @@ public class Group { private RecoveryAction recoveryAction; - private Set targets = new LinkedHashSet(); + private Set targets = Sets.newLinkedHashSet(); private String validity; diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Image.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Image.java index 2d3be5e4a8..ed3b7df8ac 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Image.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/Image.java @@ -18,7 +18,6 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -26,6 +25,7 @@ import javax.xml.bind.annotation.XmlElementWrapper; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Holds information on the system disk image of a virtual server, including the @@ -50,7 +50,7 @@ public class Image { @XmlElementWrapper(name = "softwares") @XmlElement(name = "software") - private Set software = new LinkedHashSet(); + private Set software = Sets.newLinkedHashSet(); public String getId() { return id; diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/LoadStatistics.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/LoadStatistics.java index 9e166af3ba..721801a668 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/LoadStatistics.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/LoadStatistics.java @@ -18,13 +18,13 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlRootElement; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Holds statistics of the load on a load balancer (SLB). @@ -33,7 +33,7 @@ import com.google.common.collect.ImmutableSet; */ @XmlRootElement(name = "loadstatistics") public class LoadStatistics { - private Set groups = new LinkedHashSet(); + private Set groups = Sets.newLinkedHashSet(); /** * @return the groups diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/NAT.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/NAT.java index d0fcbb2ddd..ca6b37da6b 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/NAT.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/NAT.java @@ -18,11 +18,11 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Holds the network address translation rules of a firewall. @@ -30,7 +30,7 @@ import com.google.common.collect.ImmutableSet; * @author Dies Koper */ public class NAT { - private Set rules = new LinkedHashSet(); + private Set rules = Sets.newLinkedHashSet(); /** * @return the rules diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/SLB.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/SLB.java index 40a06958c1..5e48fc7ba0 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/SLB.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/SLB.java @@ -18,12 +18,12 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlRootElement; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Represents a software load balancer. @@ -34,9 +34,9 @@ import com.google.common.collect.ImmutableSet; public class SLB extends BuiltinServer { private String ipAddress; - private Set ccacerts = new LinkedHashSet(); + private Set ccacerts = Sets.newLinkedHashSet(); - private Set servercerts = new LinkedHashSet(); + private Set servercerts = Sets.newLinkedHashSet(); private Set groups; diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/UsageInfo.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/UsageInfo.java index 61c4b368e7..b9d37b8656 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/UsageInfo.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/UsageInfo.java @@ -18,7 +18,6 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -27,6 +26,7 @@ import javax.xml.bind.annotation.XmlRootElement; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Describes the usage by a virtual system. @@ -42,7 +42,7 @@ public class UsageInfo { @XmlElementWrapper(name = "products") @XmlElement(name = "product") - private Set products = new LinkedHashSet(); + private Set products = Sets.newLinkedHashSet(); /** * @return the systemId diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VServerWithDetails.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VServerWithDetails.java index c969953896..1092fa0159 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VServerWithDetails.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VServerWithDetails.java @@ -18,7 +18,6 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -27,6 +26,7 @@ import javax.xml.bind.annotation.XmlRootElement; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Represents a virtual server with virtual storage and NICs. @@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableSet; public class VServerWithDetails extends VServerWithVNICs { @XmlElementWrapper(name = "vdisks") @XmlElement(name = "vdisk") - protected Set vdisks = new LinkedHashSet(); + protected Set vdisks = Sets.newLinkedHashSet(); protected Image image; public Set getVdisks() { diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VServerWithVNICs.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VServerWithVNICs.java index 85620e6a17..0571a29b5d 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VServerWithVNICs.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VServerWithVNICs.java @@ -1,6 +1,5 @@ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -8,12 +7,13 @@ import javax.xml.bind.annotation.XmlElementWrapper; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; public class VServerWithVNICs extends VServer { @XmlElementWrapper(name = "vnics") @XmlElement(name = "vnic") - protected Set vnics = new LinkedHashSet(); + protected Set vnics = Sets.newLinkedHashSet(); public Set getVnics() { return vnics == null ? ImmutableSet. of() : ImmutableSet diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VSystemDescriptor.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VSystemDescriptor.java index 31a7a7e2f2..893225316a 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VSystemDescriptor.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VSystemDescriptor.java @@ -18,7 +18,6 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -26,6 +25,7 @@ import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Describes a virtual system template. @@ -50,7 +50,7 @@ public class VSystemDescriptor { @XmlElementWrapper(name = "vservers") @XmlElement(name = "vserver") - private Set servers = new LinkedHashSet(); + private Set servers = Sets.newLinkedHashSet(); /** * @return the id diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VSystemWithDetails.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VSystemWithDetails.java index 7ae51fd203..fe8568fed2 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VSystemWithDetails.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/domain/VSystemWithDetails.java @@ -18,7 +18,6 @@ */ package org.jclouds.fujitsu.fgcp.domain; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -27,6 +26,7 @@ import javax.xml.bind.annotation.XmlRootElement; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Represents a virtual system with servers, additional storage, public IP @@ -38,16 +38,16 @@ import com.google.common.collect.ImmutableSet; public class VSystemWithDetails extends VSystem { @XmlElementWrapper(name = "vservers") @XmlElement(name = "vserver") - private Set servers = new LinkedHashSet(); + private Set servers = Sets.newLinkedHashSet(); @XmlElementWrapper(name = "vdisks") @XmlElement(name = "vdisk") - private Set disks = new LinkedHashSet(); + private Set disks = Sets.newLinkedHashSet(); @XmlElementWrapper(name = "publicips") @XmlElement(name = "publicip") - private Set publicips = new LinkedHashSet(); + private Set publicips = Sets.newLinkedHashSet(); @XmlElementWrapper(name = "vnets") @XmlElement(name = "vnet") - private Set networks = new LinkedHashSet(); + private Set networks = Sets.newLinkedHashSet(); public Set getServers() { return servers == null ? ImmutableSet. of() : ImmutableSet diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/location/SystemAndNetworkSegmentToLocationSupplier.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/location/SystemAndNetworkSegmentToLocationSupplier.java index 51dbb0c979..74cd62f076 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/location/SystemAndNetworkSegmentToLocationSupplier.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/location/SystemAndNetworkSegmentToLocationSupplier.java @@ -20,7 +20,6 @@ package org.jclouds.fujitsu.fgcp.location; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.ExecutionException; @@ -42,6 +41,7 @@ import com.google.common.base.Throwables; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -83,7 +83,7 @@ public class SystemAndNetworkSegmentToLocationSupplier implements public Set get() { Builder locations = ImmutableSet.builder(); try { - List> futures = new ArrayList>(); + List> futures = Lists.newArrayList(); for (VSystem system : api.getVirtualDCApi().listVirtualSystems() .get()) { diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetAddressRangeResponse.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetAddressRangeResponse.java index 799b3df445..4191e58737 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetAddressRangeResponse.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetAddressRangeResponse.java @@ -19,7 +19,6 @@ package org.jclouds.fujitsu.fgcp.xml.internal; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -29,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.fujitsu.fgcp.domain.AddressRange; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Wrapper for GetAddressRangeResponse. @@ -40,7 +40,7 @@ public class GetAddressRangeResponse extends SetWithStatusResponse { @XmlElementWrapper(name = "addressranges") @XmlElement(name = "addressrange") - private Set ranges = new LinkedHashSet(); + private Set ranges = Sets.newLinkedHashSet(); @Override protected Set delegate() { diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetEventLogResponse.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetEventLogResponse.java index 988d79dc63..6680b2da43 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetEventLogResponse.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetEventLogResponse.java @@ -19,7 +19,6 @@ package org.jclouds.fujitsu.fgcp.xml.internal; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -29,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.fujitsu.fgcp.domain.EventLog; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Wrapper for GetEventLogResponse. @@ -39,7 +39,7 @@ import com.google.common.collect.ImmutableSet; public class GetEventLogResponse extends SetWithStatusResponse { @XmlElementWrapper(name = "eventlogs") @XmlElement(name = "eventlog") - private Set logs = new LinkedHashSet(); + private Set logs = Sets.newLinkedHashSet(); @Override protected Set delegate() { diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetPerformanceInformationResponse.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetPerformanceInformationResponse.java index 2c3b5f5b09..a9afceed33 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetPerformanceInformationResponse.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/GetPerformanceInformationResponse.java @@ -19,7 +19,6 @@ package org.jclouds.fujitsu.fgcp.xml.internal; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -29,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.fujitsu.fgcp.domain.PerformanceInfo; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Wrapper for GetPerformanceInformationResponse. @@ -40,7 +40,7 @@ public class GetPerformanceInformationResponse extends SetWithStatusResponse { @XmlElementWrapper(name = "performanceinfos") @XmlElement(name = "performanceinfo") - private Set stats = new LinkedHashSet(); + private Set stats = Sets.newLinkedHashSet(); @Override protected Set delegate() { diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListDiskImageResponse.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListDiskImageResponse.java index 339b472b9d..455f29ba62 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListDiskImageResponse.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListDiskImageResponse.java @@ -19,7 +19,6 @@ package org.jclouds.fujitsu.fgcp.xml.internal; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -29,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.fujitsu.fgcp.domain.DiskImage; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Wrapper for ListDiskImageResponse. @@ -39,7 +39,7 @@ import com.google.common.collect.ImmutableSet; public class ListDiskImageResponse extends SetWithStatusResponse { @XmlElementWrapper(name = "diskimages") @XmlElement(name = "diskimage") - private Set diskImages = new LinkedHashSet(); + private Set diskImages = Sets.newLinkedHashSet(); @Override protected Set delegate() { diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListEFMBackupResponse.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListEFMBackupResponse.java index 2acbfd4141..5f9b18b0bb 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListEFMBackupResponse.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListEFMBackupResponse.java @@ -19,7 +19,6 @@ package org.jclouds.fujitsu.fgcp.xml.internal; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -29,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.fujitsu.fgcp.domain.BuiltinServerBackup; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Wrapper for ListEFMBackupResponse. @@ -40,7 +40,7 @@ public class ListEFMBackupResponse extends SetWithStatusResponse { @XmlElementWrapper(name = "backups") @XmlElement(name = "backup") - private Set backup = new LinkedHashSet(); + private Set backup = Sets.newLinkedHashSet(); @Override protected Set delegate() { diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListEFMResponse.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListEFMResponse.java index cffa13f681..ecc97c6622 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListEFMResponse.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListEFMResponse.java @@ -19,7 +19,6 @@ package org.jclouds.fujitsu.fgcp.xml.internal; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -29,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.fujitsu.fgcp.domain.BuiltinServer; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Wrapper for ListEFMResponse. @@ -39,7 +39,7 @@ import com.google.common.collect.ImmutableSet; public class ListEFMResponse extends SetWithStatusResponse { @XmlElementWrapper(name = "efms") @XmlElement(name = "efm") - private Set efm = new LinkedHashSet(); + private Set efm = Sets.newLinkedHashSet(); @Override protected Set delegate() { diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVDiskResponse.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVDiskResponse.java index 3be8d5d6ea..1e96a46484 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVDiskResponse.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVDiskResponse.java @@ -19,7 +19,6 @@ package org.jclouds.fujitsu.fgcp.xml.internal; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -29,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.fujitsu.fgcp.domain.VDisk; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Wrapper for ListVDiskResponse. @@ -39,7 +39,7 @@ import com.google.common.collect.ImmutableSet; public class ListVDiskResponse extends SetWithStatusResponse { @XmlElementWrapper(name = "vdisks") @XmlElement(name = "vdisk") - private Set disks = new LinkedHashSet(); + private Set disks = Sets.newLinkedHashSet(); @Override protected Set delegate() { diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVSYSResponse.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVSYSResponse.java index 0cce1b252e..a3457c9eda 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVSYSResponse.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVSYSResponse.java @@ -19,7 +19,6 @@ package org.jclouds.fujitsu.fgcp.xml.internal; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -29,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.fujitsu.fgcp.domain.VSystem; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Wrapper for ListVSYSResponse. @@ -39,7 +39,7 @@ import com.google.common.collect.ImmutableSet; public class ListVSYSResponse extends SetWithStatusResponse { @XmlElementWrapper(name = "vsyss") @XmlElement(name = "vsys") - private Set systems = new LinkedHashSet(); + private Set systems = Sets.newLinkedHashSet(); @Override protected Set delegate() { diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVServerResponse.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVServerResponse.java index 2d8dc4e161..9aaaec7f7e 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVServerResponse.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/xml/internal/ListVServerResponse.java @@ -19,7 +19,6 @@ package org.jclouds.fujitsu.fgcp.xml.internal; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.Set; import javax.xml.bind.annotation.XmlElement; @@ -29,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.fujitsu.fgcp.domain.VServer; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Wrapper for ListVServerResponse. @@ -39,7 +39,7 @@ import com.google.common.collect.ImmutableSet; public class ListVServerResponse extends SetWithStatusResponse { @XmlElementWrapper(name = "vservers") @XmlElement(name = "vserver") - private Set servers = new LinkedHashSet(); + private Set servers = Sets.newLinkedHashSet(); @Override protected Set delegate() { diff --git a/labs/nodepool/src/main/java/org/jclouds/nodepool/internal/NodeMetadataStoreCache.java b/labs/nodepool/src/main/java/org/jclouds/nodepool/internal/NodeMetadataStoreCache.java index af71a93513..bd752cb93d 100644 --- a/labs/nodepool/src/main/java/org/jclouds/nodepool/internal/NodeMetadataStoreCache.java +++ b/labs/nodepool/src/main/java/org/jclouds/nodepool/internal/NodeMetadataStoreCache.java @@ -18,7 +18,6 @@ */ package org.jclouds.nodepool.internal; -import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -31,11 +30,12 @@ import org.jclouds.compute.options.TemplateOptions; import com.google.common.base.Function; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; @Singleton public class NodeMetadataStoreCache implements NodeMetadataStore { - private Map frontendMetadataCache = new HashMap(); + private Map frontendMetadataCache = Maps.newHashMap(); private NodeMetadataStore backend; @Inject diff --git a/labs/smartos-ssh/src/main/java/org/jclouds/smartos/compute/strategy/SmartOSComputeServiceAdapter.java b/labs/smartos-ssh/src/main/java/org/jclouds/smartos/compute/strategy/SmartOSComputeServiceAdapter.java index f1b0537fca..1b653a231d 100644 --- a/labs/smartos-ssh/src/main/java/org/jclouds/smartos/compute/strategy/SmartOSComputeServiceAdapter.java +++ b/labs/smartos-ssh/src/main/java/org/jclouds/smartos/compute/strategy/SmartOSComputeServiceAdapter.java @@ -20,7 +20,6 @@ package org.jclouds.smartos.compute.strategy; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.ArrayList; import java.util.Collection; import java.util.Map; import java.util.UUID; @@ -39,6 +38,7 @@ import org.jclouds.smartos.compute.domain.VmSpecification; import com.google.common.base.Function; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; /** @@ -56,7 +56,7 @@ public class SmartOSComputeServiceAdapter implements ComputeServiceAdapter specifications = new ArrayList(); + Collection specifications = Lists.newArrayList(); specifications.add(VmSpecification.builder().alias("Standard Joyent VM, 1Gb RAM / 2Gb SWAP").ram(1024).maxSwap(2048) .nic(VmNIC.builder().simpleDHCPNic().build()).build()); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/params/RecomposeVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/params/RecomposeVAppParams.java index a65f98d903..0d75465f61 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/params/RecomposeVAppParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/params/RecomposeVAppParams.java @@ -20,7 +20,6 @@ package org.jclouds.vcloud.director.v1_5.domain.params; import static com.google.common.base.Objects.equal; -import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlElement; @@ -32,6 +31,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Vm; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; +import com.google.common.collect.Lists; /** * Represents vApp re-composition parameters. @@ -117,7 +117,7 @@ public class RecomposeVAppParams extends ComposeVAppParams { */ public List getCreateItem() { if (createItem == null) { - createItem = new ArrayList(); + createItem = Lists.newArrayList(); } return this.createItem; } @@ -127,7 +127,7 @@ public class RecomposeVAppParams extends ComposeVAppParams { */ public List getDeleteItem() { if (removeItem == null) { - removeItem = new ArrayList(); + removeItem = Lists.newArrayList(); } return this.removeItem; } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryApiLiveTest.java index b66b28fb09..45e5de0737 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryApiLiveTest.java @@ -26,7 +26,6 @@ import static org.testng.Assert.assertTrue; import java.net.URI; import java.util.Arrays; import java.util.Collection; -import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -50,6 +49,7 @@ import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; +import com.google.common.collect.Sets; /** * Tests live behavior of {@link QueryApi}. @@ -230,7 +230,7 @@ public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest { } private Set toHrefs(QueryResultRecords queryResult) { - Set hrefs = new LinkedHashSet(); + Set hrefs = Sets.newLinkedHashSet(); for (QueryResultRecordType record : queryResult.getRecords()) { hrefs.add(record.getHref()); } @@ -238,7 +238,7 @@ public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest { } private Set toHrefs(Iterable resources) { - Set hrefs = new LinkedHashSet(); + Set hrefs = Sets.newLinkedHashSet(); for (Resource resource : resources) { hrefs.add(resource.getHref()); } diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtension.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtension.java index 122a761e62..4970f9f930 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtension.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtension.java @@ -25,7 +25,6 @@ import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_DEFAU import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_WORKINGDIR; -import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; @@ -60,6 +59,7 @@ import com.google.common.base.Optional; import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -122,7 +122,7 @@ public class VirtualBoxImageExtension implements ImageExtension { IMachine clonedMachine = manager.get().getVBox() .createMachine(settingsFile, template.getName(), source.getOSTypeId(), template.getName(), true); - List options = new ArrayList(); + List options = Lists.newArrayList(); if (isLinkedClone) options.add(CloneOptions.Link); diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java index 62b2930422..70ade79c54 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java @@ -20,12 +20,11 @@ package org.jclouds.virtualbox.domain; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.ArrayList; import java.util.List; import com.google.common.base.Objects; import com.google.common.collect.ImmutableList; - +import com.google.common.collect.Lists; /** * Describes the network configuration for a VirtualBox machine. @@ -44,7 +43,7 @@ public class NetworkSpec { public static class Builder { - private List networkInterfaceCards = new ArrayList(); + private List networkInterfaceCards = Lists.newArrayList(); public Builder addNIC(NetworkInterfaceCard networkInterfaceCard) { this.networkInterfaceCards.add(networkInterfaceCard); diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java index f38db537ef..f662230b5a 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java @@ -21,7 +21,6 @@ package org.jclouds.virtualbox.domain; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.Iterables.filter; -import java.util.HashSet; import java.util.Set; import org.jclouds.javax.annotation.Nullable; @@ -31,6 +30,7 @@ import org.virtualbox_4_1.StorageBus; import com.google.common.base.Objects; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; +import com.google.common.collect.Sets; /** * Represents a storage controller in a VirtualBox VM. @@ -117,8 +117,8 @@ public class StorageController { private String name; private StorageBus bus; - private Set hardDisks = new HashSet(); - private Set dvds = new HashSet(); + private Set hardDisks = Sets.newHashSet(); + private Set dvds = Sets.newHashSet(); public Builder name(String name) { this.name = name; diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java index 7ae072600b..79deb2df62 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java @@ -22,12 +22,12 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import java.util.Collections; -import java.util.HashSet; import java.util.Set; import org.virtualbox_4_1.CleanupMode; import com.google.common.base.Objects; +import com.google.common.collect.Sets; /** * A description of a Virtual Machine in VirtualBox. @@ -60,7 +60,7 @@ public class VmSpec { public static class Builder { - private Set controllers = new HashSet(); + private Set controllers = Sets.newHashSet(); private String name; private String id; diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java index fb52ca5d64..b6004e4e9f 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java @@ -22,7 +22,6 @@ package org.jclouds.virtualbox.functions; import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_PASSWORD; import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_USER; -import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; @@ -46,6 +45,7 @@ import org.virtualbox_4_1.VirtualBoxManager; import com.google.common.base.Function; import com.google.common.base.Supplier; +import com.google.common.collect.Lists; import com.google.inject.Inject; /** @@ -103,7 +103,7 @@ public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExists implements Fu .createMachine(settingsFile, vmSpec.getVmName(), vmSpec.getOsTypeId(), vmSpec.getVmId(), vmSpec.isForceOverwrite()); - List options = new ArrayList(); + List options = Lists.newArrayList(); if (isLinkedClone) options.add(CloneOptions.Link); diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java index 027cc15682..f7e8a8a9db 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java @@ -24,7 +24,6 @@ import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_USER; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_NAME_SEPARATOR; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_PREFIX; -import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -49,6 +48,7 @@ import org.virtualbox_4_1.NetworkAttachmentType; import com.google.common.base.Function; import com.google.common.base.Splitter; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -108,8 +108,8 @@ public class IMachineToNodeMetadata implements Function } private NodeMetadataBuilder getIpAddresses(IMachine vm, NodeMetadataBuilder nodeMetadataBuilder) { - List publicIpAddresses = new ArrayList(); - List privateIpAddresses = new ArrayList(); + List publicIpAddresses = Lists.newArrayList(); + List privateIpAddresses = Lists.newArrayList(); for(long slot = 0; slot < 4; slot ++) { INetworkAdapter adapter = vm.getNetworkAdapter(slot); if(adapter != null) { diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java index 9c4ce98cce..2e1cfbc352 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java @@ -34,7 +34,6 @@ import static org.jclouds.virtualbox.util.MachineUtils.machineNotFoundException; import java.io.File; import java.net.URI; import java.net.URISyntaxException; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -84,6 +83,7 @@ import com.google.common.base.Splitter; import com.google.common.base.Supplier; import com.google.common.cache.AbstractLoadingCache; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.net.HostAndPort; @@ -292,7 +292,7 @@ public class MastersLoadingCache extends AbstractLoadingCache { throw new RuntimeException("could not connect to virtualbox"); } File file = new File(isosDir, fileName); - List statements = new ArrayList(); + List statements = Lists.newArrayList(); statements.add(Statements.saveHttpResponseTo(URI.create(httpUrl), isosDir, fileName)); StatementList statementList = new StatementList(statements); diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/StringToKeyCode.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/StringToKeyCode.java index 2899bea7ad..789d06f51a 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/StringToKeyCode.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/StringToKeyCode.java @@ -18,7 +18,6 @@ */ package org.jclouds.virtualbox.functions; -import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -26,6 +25,7 @@ import org.jclouds.virtualbox.settings.KeyboardScancodes; import com.google.common.base.Function; import com.google.common.base.Splitter; +import com.google.common.collect.Lists; public class StringToKeyCode implements Function> { @@ -43,7 +43,7 @@ public class StringToKeyCode implements Function> { } private List transformStandardCharacterIntoKeycodes(String s) { - List values = new ArrayList(); + List values = Lists.newArrayList(); for (String digit : Splitter.fixedLength(1).split(s)) { Collection hex = KeyboardScancodes.NORMAL_KEYBOARD_BUTTON_MAP_LIST.get(digit); if (hex != null) @@ -54,7 +54,7 @@ public class StringToKeyCode implements Function> { } private List transformSpecialCharIntoKeycodes(String s) { - List values = new ArrayList(); + List values = Lists.newArrayList(); for (String special : s.split("<")) { Collection value = KeyboardScancodes.SPECIAL_KEYBOARD_BUTTON_MAP_LIST.get("<" + special); if (value != null) diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java index d92cc71439..c304edcfcc 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java @@ -24,7 +24,6 @@ import static com.google.common.base.Preconditions.checkState; import static org.jclouds.compute.options.RunScriptOptions.Builder.runAsRoot; import java.net.URI; -import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; @@ -49,6 +48,7 @@ import org.virtualbox_4_1.VirtualBoxManager; import com.google.common.base.Function; import com.google.common.base.Supplier; +import com.google.common.collect.Lists; import com.google.common.net.HostAndPort; @Singleton @@ -120,7 +120,7 @@ public class StartVBoxIfNotAlreadyRunning implements Supplier private void cleanUpHost(URI provider, NodeMetadata hostNodeMetadata) { // kill previously started vboxwebsrv (possibly dirty session) - List statements = new ArrayList(); + List statements = Lists.newArrayList(); statements.add(Statements.findPid("vboxwebsrv")); statements.add(Statements.kill()); StatementList statementList = new StatementList(statements); diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/statements/EnableNetworkInterface.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/statements/EnableNetworkInterface.java index 8a9523af99..2df684c394 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/statements/EnableNetworkInterface.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/statements/EnableNetworkInterface.java @@ -22,9 +22,10 @@ package org.jclouds.virtualbox.statements; import static com.google.common.base.Preconditions.checkNotNull; import static org.jclouds.scriptbuilder.domain.Statements.exec; -import java.util.ArrayList; import java.util.List; +import com.google.common.collect.Lists; + import org.jclouds.scriptbuilder.domain.OsFamily; import org.jclouds.scriptbuilder.domain.Statement; import org.jclouds.scriptbuilder.domain.StatementList; @@ -63,7 +64,7 @@ public class EnableNetworkInterface implements Statement { } private List getStatements(String iface) { - List statements = new ArrayList(); + List statements = Lists.newArrayList(); statements.add(exec(String.format("echo auto %s >> /etc/network/interfaces", iface))); // statements.add(exec(String.format("echo iface %s inet dhcp >> /etc/network/interfaces", iface))); // statements.add(exec("/etc/init.d/networking restart")); diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/statements/InstallGuestAdditions.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/statements/InstallGuestAdditions.java index 8c770ab81a..a5cef31aa7 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/statements/InstallGuestAdditions.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/statements/InstallGuestAdditions.java @@ -25,7 +25,6 @@ import static org.jclouds.scriptbuilder.domain.Statements.exec; import static org.jclouds.scriptbuilder.domain.Statements.saveHttpResponseTo; import java.net.URI; -import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; @@ -42,6 +41,7 @@ import org.jclouds.virtualbox.domain.VmSpec; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; /** * Mounts the DVD with guest additions that was downloaded and attached as removable storage. If no @@ -62,7 +62,7 @@ public class InstallGuestAdditions implements Statement { } private List getStatements(VmSpec vmSpecification, String vboxVersion) { - List statements = new ArrayList(); + List statements = Lists.newArrayList(); statements.add(call("installModuleAssistantIfNeeded")); String mountPoint = "/mnt"; if (Iterables.tryFind(vmSpecification.getControllers(), new Predicate() { diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterTest.java index fe92582421..807d31320d 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterTest.java @@ -24,7 +24,6 @@ import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX; -import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -45,6 +44,7 @@ import org.virtualbox_4_1.VirtualBoxManager; import com.google.common.base.Function; import com.google.common.base.Suppliers; +import com.google.common.collect.Lists; import com.google.inject.Guice; @Test(groups = "unit") @@ -61,7 +61,7 @@ public class VirtualBoxComputeServiceAdapterTest { IVirtualBox vBox = createNiceMock(IVirtualBox.class); IGuestOSType osType = createNiceMock(IGuestOSType.class); - List machines = new ArrayList(); + List machines = Lists.newArrayList(); IMachine imageMachine = createNiceMock(IMachine.class); IMachine clonedMachine = createNiceMock(IMachine.class); machines.add(imageMachine); diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java index 391f77613b..fdfbd709e6 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java @@ -24,10 +24,11 @@ import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.expectLastCall; import static org.easymock.EasyMock.replay; -import java.util.ArrayList; import java.util.Collections; import java.util.List; +import com.google.common.collect.Lists; + import org.jclouds.virtualbox.domain.HardDisk; import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; @@ -55,7 +56,7 @@ public class UnregisterMachineIfExistsAndDeleteItsMediaTest { IVirtualBox vBox = createMock(IVirtualBox.class); IMachine registeredMachine = createMock(IMachine.class); IProgress progress = createNiceMock(IProgress.class); - List media = new ArrayList(); + List media = Lists.newArrayList(); List mediums = Collections.unmodifiableList(media); StorageController ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE) diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiExpectTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiExpectTest.java index f0053efc57..a5e27e8353 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiExpectTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiExpectTest.java @@ -22,7 +22,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; -import java.util.LinkedHashMap; import java.util.Map; import javax.ws.rs.core.MediaType; @@ -54,6 +53,7 @@ import org.jclouds.rest.ResourceNotFoundException; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; /** * Tests annotation parsing of {@code ServerAsyncApi} @@ -92,7 +92,7 @@ public class ServerApiExpectTest extends BaseGleSYSApiExpectTest { .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build(), HttpResponse.builder().statusCode(204).payload(payloadFromResource("/server_allowed_arguments.json")).build()).getServerApi(); - Map expected = new LinkedHashMap(); + Map expected = Maps.newLinkedHashMap(); AllowedArgumentsForCreateServer openvz = AllowedArgumentsForCreateServer.builder() .dataCenters("Amsterdam", "Falkenberg", "New York City", "Stockholm") .memorySizes(128, 256, 512, 768, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288) diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridLiveTestDisabled.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridLiveTestDisabled.java index 5e1d061f04..dba7d41b05 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridLiveTestDisabled.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridLiveTestDisabled.java @@ -25,7 +25,6 @@ import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.Iterator; @@ -56,6 +55,7 @@ import org.testng.annotations.Test; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import com.google.common.net.HostAndPort; /** @@ -79,8 +79,8 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { /** * Keeps track of the servers, created during the tests, to remove them after all tests complete */ - private List serversToDeleteAfterTheTests = new ArrayList(); - private List loadBalancersToDeleteAfterTest = new ArrayList(); + private List serversToDeleteAfterTheTests = Lists.newArrayList(); + private List loadBalancersToDeleteAfterTest = Lists.newArrayList(); private RestContext gocontext; diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/CreateServerOptions.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/CreateServerOptions.java index ccd96ee5df..699d961e06 100644 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/CreateServerOptions.java +++ b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/CreateServerOptions.java @@ -20,12 +20,13 @@ package org.jclouds.rimuhosting.miro.binder; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.inject.Inject; +import com.google.common.collect.Lists; + import org.jclouds.http.HttpRequest; import org.jclouds.json.Json; import org.jclouds.rimuhosting.miro.data.CreateOptions; @@ -42,7 +43,7 @@ public class CreateServerOptions extends RimuHostingJsonBinder { } private String password; - private List metaData = new ArrayList(); + private List metaData = Lists.newArrayList(); @Override public R bindToRequest(R request, Map postParams) { diff --git a/resources/checkstyle.xml b/resources/checkstyle.xml index 8270b15cc9..363dd7e91b 100644 --- a/resources/checkstyle.xml +++ b/resources/checkstyle.xml @@ -15,4 +15,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +