mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r1134456 [5/6] - in /mahout/trunk: core/src/main/java/org/apache/mahout/cf/taste/common/ core/src/main/java/org/apache/mahout/cf/taste/hadoop/ core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ core/src/main/java/org/apache/mahout/cf...
Date Fri, 10 Jun 2011 21:58:23 GMT
Modified: mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/FPGrowthRetailDataTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/FPGrowthRetailDataTest.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/FPGrowthRetailDataTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/FPGrowthRetailDataTest.java Fri Jun 10 21:58:14 2011
@@ -18,12 +18,12 @@
 package org.apache.mahout.fpm.pfpgrowth;
 
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import com.google.common.collect.Maps;
 import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.mahout.common.MahoutTestCase;
 import org.apache.mahout.common.Pair;
@@ -52,7 +52,7 @@ public final class FPGrowthRetailDataTes
       }
     }
     
-    final Map<Set<String>,Long> results = new HashMap<Set<String>,Long>();
+    final Map<Set<String>,Long> results = Maps.newHashMap();
     
     Set<String> returnableFeatures = new HashSet<String>();
     returnableFeatures.add("41");
@@ -90,7 +90,7 @@ public final class FPGrowthRetailDataTes
   public void testRetailDataMinSup100() throws IOException {
     StringRecordIterator it = new StringRecordIterator(new FileLineIterable(Resources.getResource(
       "retail_results_with_min_sup_100.dat").openStream()), "\\s+");
-    final Map<Set<String>,Long> expectedResults = new HashMap<Set<String>,Long>();
+    final Map<Set<String>,Long> expectedResults = Maps.newHashMap();
     while (it.hasNext()) {
       Pair<List<String>,Long> next = it.next();
       List<String> items = new ArrayList<String>(next.getFirst());

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/FPGrowthTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/FPGrowthTest.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/FPGrowthTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/FPGrowthTest.java Fri Jun 10 21:58:14 2011
@@ -17,12 +17,12 @@
 
 package org.apache.mahout.fpm.pfpgrowth;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import com.google.common.io.Closeables;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
@@ -46,7 +46,7 @@ public final class FPGrowthTest extends 
 
     FPGrowth<String> fp = new FPGrowth<String>();
 
-    Collection<Pair<List<String>,Long>> transactions = new ArrayList<Pair<List<String>,Long>>();
+    Collection<Pair<List<String>,Long>> transactions = Lists.newArrayList();
     transactions.add(new Pair<List<String>,Long>(Arrays.asList("E", "A", "D", "B"), 1L));
     transactions.add(new Pair<List<String>,Long>(Arrays.asList("D", "A", "C", "E", "B"), 1L));
     transactions.add(new Pair<List<String>,Long>(Arrays.asList("C", "A", "B", "E"), 1L));
@@ -94,7 +94,7 @@ public final class FPGrowthTest extends 
 
     FPGrowth<String> fp = new FPGrowth<String>();
 
-    Collection<Pair<List<String>,Long>> transactions = new ArrayList<Pair<List<String>,Long>>();
+    Collection<Pair<List<String>,Long>> transactions = Lists.newArrayList();
     transactions.add(new Pair<List<String>,Long>(Arrays.asList("X"), 12L));
     transactions.add(new Pair<List<String>,Long>(Arrays.asList("Y"), 4L));
     transactions.add(new Pair<List<String>,Long>(Arrays.asList("X", "Y"), 10L));
@@ -131,7 +131,7 @@ public final class FPGrowthTest extends 
 
     FPGrowth<String> fp = new FPGrowth<String>();
 
-    Collection<Pair<List<String>,Long>> transactions = new ArrayList<Pair<List<String>,Long>>();
+    Collection<Pair<List<String>,Long>> transactions = Lists.newArrayList();
     transactions.add(new Pair<List<String>,Long>(Arrays.asList("X"), 12L));
     transactions.add(new Pair<List<String>,Long>(Arrays.asList("Y"), 4L));
     transactions.add(new Pair<List<String>,Long>(Arrays.asList("X", "Y"), 10L));
@@ -170,7 +170,7 @@ public final class FPGrowthTest extends 
 
     FPGrowth<String> fp = new FPGrowth<String>();
 
-    Collection<Pair<List<String>,Long>> transactions = new ArrayList<Pair<List<String>,Long>>();
+    Collection<Pair<List<String>,Long>> transactions = Lists.newArrayList();
     transactions.add(new Pair<List<String>,Long>(Arrays.asList("E", "A", "D", "B"), 1L));
 
     OutputCollector<String, List<Pair<List<String>, Long>>> noOutput =

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowthRetailDataTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowthRetailDataTest.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowthRetailDataTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowthRetailDataTest.java Fri Jun 10 21:58:14 2011
@@ -19,9 +19,7 @@ package org.apache.mahout.fpm.pfpgrowth;
 
 import java.io.File;
 import java.io.Writer;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -30,6 +28,8 @@ import java.util.Map.Entry;
 import java.util.Set;
 
 import com.google.common.base.Charsets;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.google.common.io.Closeables;
 import com.google.common.io.Files;
 import org.apache.mahout.common.MahoutTestCase;
@@ -65,7 +65,7 @@ public class PFPGrowthRetailDataTest ext
     try {
       StringRecordIterator it = new StringRecordIterator(new FileLineIterable(Resources.getResource(
         "retail.dat").openStream()), "\\s+");
-      Collection<List<String>> transactions = new ArrayList<List<String>>();
+      Collection<List<String>> transactions = Lists.newArrayList();
       
       while (it.hasNext()) {
         Pair<List<String>,Long> next = it.next();
@@ -91,10 +91,10 @@ public class PFPGrowthRetailDataTest ext
     StringRecordIterator it = new StringRecordIterator(new FileLineIterable(Resources.getResource(
       "retail_results_with_min_sup_100.dat").openStream()), "\\s+");
     
-    Map<Set<String>,Long> expectedResults = new HashMap<Set<String>,Long>();
+    Map<Set<String>,Long> expectedResults = Maps.newHashMap();
     while (it.hasNext()) {
       Pair<List<String>,Long> next = it.next();
-      List<String> items = new ArrayList<String>(next.getFirst());
+      List<String> items = Lists.newArrayList(next.getFirst());
       String supportString = items.remove(items.size() - 1);
       Long support = Long.parseLong(supportString.substring(1, supportString.length() - 1));
       expectedResults.put(new HashSet<String>(items), support);
@@ -112,7 +112,7 @@ public class PFPGrowthRetailDataTest ext
     PFPGrowth.startAggregating(params);
     List<Pair<String,TopKStringPatterns>> frequentPatterns = PFPGrowth.readFrequentPattern(params);
     
-    Map<Set<String>,Long> results = new HashMap<Set<String>,Long>();
+    Map<Set<String>,Long> results = Maps.newHashMap();
     for (Pair<String,TopKStringPatterns> topK : frequentPatterns) {
       Iterator<Pair<List<String>,Long>> topKIt = topK.getSecond().iterator();
       while (topKIt.hasNext()) {

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowthTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowthTest.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowthTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowthTest.java Fri Jun 10 21:58:14 2011
@@ -19,13 +19,13 @@ package org.apache.mahout.fpm.pfpgrowth;
 
 import java.io.File;
 import java.io.Writer;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
 import com.google.common.base.Charsets;
+import com.google.common.collect.Lists;
 import com.google.common.io.Closeables;
 import com.google.common.io.Files;
 import org.apache.hadoop.conf.Configuration;
@@ -57,7 +57,7 @@ public final class PFPGrowthTest extends
     params.set(PFPGrowth.OUTPUT, outputDir.getAbsolutePath());
     Writer writer = Files.newWriter(input, Charsets.UTF_8);
     try {
-      Collection<List<String>> transactions = new ArrayList<List<String>>();
+      Collection<List<String>> transactions = Lists.newArrayList();
       transactions.add(Arrays.asList("E", "A", "D", "B"));
       transactions.add(Arrays.asList("D", "A", "C", "E", "B"));
       transactions.add(Arrays.asList("C", "A", "B", "E"));

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/TransactionTreeTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/TransactionTreeTest.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/TransactionTreeTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/fpm/pfpgrowth/TransactionTreeTest.java Fri Jun 10 21:58:14 2011
@@ -17,11 +17,11 @@
 
 package org.apache.mahout.fpm.pfpgrowth;
 
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Random;
 
+import com.google.common.collect.Lists;
 import org.apache.mahout.common.MahoutTestCase;
 import org.apache.mahout.common.Pair;
 import org.apache.mahout.common.RandomUtils;
@@ -53,7 +53,7 @@ public final class TransactionTreeTest e
   }
 
   private List<Integer> generateRandomArray() {
-    List<Integer> list = new ArrayList<Integer>();
+    List<Integer> list = Lists.newArrayList();
     for (int i = 0; i < MAX_FEATURES; i++) {
       if (gen.nextInt() % SKIP_RATE == 0) {
         list.add(i);

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/MahoutEvaluatorTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/MahoutEvaluatorTest.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/MahoutEvaluatorTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/MahoutEvaluatorTest.java Fri Jun 10 21:58:14 2011
@@ -17,6 +17,7 @@
 
 package org.apache.mahout.ga.watchmaker;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FileSystem;
@@ -30,7 +31,6 @@ import org.junit.Test;
 import org.uncommons.watchmaker.framework.FitnessEvaluator;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
 public final class MahoutEvaluatorTest extends MahoutTestCase {
@@ -47,7 +47,7 @@ public final class MahoutEvaluatorTest e
     FitnessEvaluator<DummyCandidate> evaluator = new DummyEvaluator();
 
     // run MahoutEvaluator
-    List<Double> results = new ArrayList<Double>();
+    List<Double> results = Lists.newArrayList();
     Path input = getTestTempDirPath("input");
     Path output = getTestTempDirPath("output");
 
@@ -83,7 +83,7 @@ public final class MahoutEvaluatorTest e
   }
 
   private static List<DummyCandidate> loadPopulation(FileSystem fs, Path f) throws IOException {
-    List<DummyCandidate> population = new ArrayList<DummyCandidate>();
+    List<DummyCandidate> population = Lists.newArrayList();
     FSDataInputStream in = fs.open(f);
     for (String line : new FileLineIterable(in)) {
       population.add(StringUtils.<DummyCandidate>fromString(line));

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluatorTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluatorTest.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluatorTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluatorTest.java Fri Jun 10 21:58:14 2011
@@ -17,11 +17,11 @@
 
 package org.apache.mahout.ga.watchmaker;
 
+import com.google.common.collect.Lists;
 import org.apache.mahout.common.MahoutTestCase;
 import org.apache.mahout.common.RandomUtils;
 import org.junit.Test;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
@@ -112,7 +112,7 @@ public final class STFitnessEvaluatorTes
   }
 
   private static List<Integer> randomInts(int size, Random rng) {
-    List<Integer> population = new ArrayList<Integer>();
+    List<Integer> population = Lists.newArrayList();
     for (int index = 0; index < size; index++) {
       population.add(rng.nextInt());
     }
@@ -121,7 +121,7 @@ public final class STFitnessEvaluatorTes
   }
 
   private static List<Double> randomFloats(int size, Random rng) {
-    List<Double> population = new ArrayList<Double>();
+    List<Double> population = Lists.newArrayList();
     for (int index = 0; index < size; index++) {
       population.add(rng.nextDouble());
     }

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyCandidate.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyCandidate.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyCandidate.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyCandidate.java Fri Jun 10 21:58:14 2011
@@ -18,8 +18,8 @@
 package org.apache.mahout.ga.watchmaker.utils;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 
-import java.util.ArrayList;
 import java.util.List;
 
 public final class DummyCandidate {
@@ -61,7 +61,7 @@ public final class DummyCandidate {
   public static List<DummyCandidate> generatePopulation(int size) {
     Preconditions.checkArgument(size > 0, "Size must be positive", size);
 
-    List<DummyCandidate> population = new ArrayList<DummyCandidate>();
+    List<DummyCandidate> population = Lists.newArrayList();
     for (int index = 0; index < size; index++) {
       population.add(new DummyCandidate(index));
     }

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyEvaluator.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyEvaluator.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyEvaluator.java Fri Jun 10 21:58:14 2011
@@ -17,10 +17,10 @@
 
 package org.apache.mahout.ga.watchmaker.utils;
 
+import com.google.common.collect.Maps;
 import org.uncommons.watchmaker.framework.FitnessEvaluator;
 import org.apache.mahout.common.RandomUtils;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
@@ -33,7 +33,7 @@ public final class DummyEvaluator implem
 
   private final Random rng = RandomUtils.getRandom();
 
-  private static final Map<Integer, Double> evaluations = new HashMap<Integer, Double>();
+  private static final Map<Integer, Double> evaluations = Maps.newHashMap();
 
   public static double getFitness(Integer key) {
     if (!evaluations.containsKey(key)) {

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java Fri Jun 10 21:58:14 2011
@@ -20,6 +20,7 @@ package org.apache.mahout.math.hadoop;
 import java.io.IOException;
 import java.util.Iterator;
 
+import com.google.common.io.Closeables;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -201,7 +202,7 @@ public final class MathHelper {
         writer.append(new IntWritable(n), new VectorWritable(v));
       }
     } finally {
-      IOUtils.quietClose(writer);
+      Closeables.closeQuietly(writer);
     }
   }
 }

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/TestDistributedRowMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/TestDistributedRowMatrix.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/TestDistributedRowMatrix.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/TestDistributedRowMatrix.java Fri Jun 10 21:58:14 2011
@@ -17,6 +17,7 @@
 
 package org.apache.mahout.math.hadoop;
 
+import com.google.common.collect.Maps;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -33,7 +34,6 @@ import org.apache.mahout.math.decomposer
 import org.junit.Test;
 
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -44,8 +44,8 @@ public final class TestDistributedRowMat
   private static void assertEquals(VectorIterable m, VectorIterable mtt, double errorTolerance) {
     Iterator<MatrixSlice> mIt = m.iterateAll();
     Iterator<MatrixSlice> mttIt = mtt.iterateAll();
-    Map<Integer, Vector> mMap = new HashMap<Integer,Vector>();
-    Map<Integer, Vector> mttMap = new HashMap<Integer, Vector>();
+    Map<Integer, Vector> mMap = Maps.newHashMap();
+    Map<Integer, Vector> mttMap = Maps.newHashMap();
     while (mIt.hasNext() && mttIt.hasNext()) {
       MatrixSlice ms = mIt.next();
       mMap.put(ms.index(), ms.vector());

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java Fri Jun 10 21:58:14 2011
@@ -17,6 +17,7 @@
 
 package org.apache.mahout.math.hadoop.decomposer;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.mahout.common.MahoutTestCase;
@@ -32,7 +33,6 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Arrays;
 
@@ -110,7 +110,7 @@ public final class TestDistributedLanczo
   
     Path cleanEigenvectors = new Path(output, EigenVerificationJob.CLEAN_EIGENVECTORS);
     Matrix eigenVectors = new DenseMatrix(6, corpus.numCols());
-    Collection<Double> eigenvalues = new ArrayList<Double>();
+    Collection<Double> eigenvalues = Lists.newArrayList();
 
     output = getTestTempDirPath("output2");
     tmp = getTestTempDirPath("tmp2");
@@ -128,7 +128,7 @@ public final class TestDistributedLanczo
     Path cleanEigenvectors2 = new Path(output, EigenVerificationJob.CLEAN_EIGENVECTORS);
     Matrix eigenVectors2 = new DenseMatrix(7, corpus.numCols());
     Configuration conf = new Configuration();
-    Collection<Double> newEigenValues = new ArrayList<Double>();
+    Collection<Double> newEigenValues = Lists.newArrayList();
 
     int i = 0;
     for (VectorWritable value : new SequenceFileValueIterable<VectorWritable>(cleanEigenvectors, conf)) {
@@ -151,7 +151,7 @@ public final class TestDistributedLanczo
       i++;
     }
 
-    Collection<Integer> oldEigensFound = new ArrayList<Integer>();
+    Collection<Integer> oldEigensFound = Lists.newArrayList();
     for(int row = 0; row < eigenVectors.numRows(); row++) {
       Vector oldEigen = eigenVectors.getRow(row);
       if(oldEigen == null) {
@@ -169,7 +169,7 @@ public final class TestDistributedLanczo
     }
     assertEquals("the number of new eigenvectors", 5, i);
 
-    Collection<Double> oldEigenValuesNotFound = new ArrayList<Double>();
+    Collection<Double> oldEigenValuesNotFound = Lists.newArrayList();
     for(double d : eigenvalues) {
       boolean found = false;
       for(double newD : newEigenValues) {

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/collocations/llr/GramTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/collocations/llr/GramTest.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/collocations/llr/GramTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/collocations/llr/GramTest.java Fri Jun 10 21:58:14 2011
@@ -26,6 +26,7 @@ import java.io.DataOutputStream;
 import java.util.Arrays;
 import java.util.HashMap;
 
+import com.google.common.collect.Maps;
 import org.apache.mahout.common.MahoutTestCase;
 import org.junit.Test;
 
@@ -112,7 +113,7 @@ public final class GramTest extends Maho
      new Gram("bar", Gram.Type.UNIGRAM)
     };
     
-    HashMap<Gram,Gram> map = new HashMap<Gram,Gram>();
+    HashMap<Gram,Gram> map = Maps.newHashMap();
     for (Gram n : input) {
       Gram val = map.get(n);
       if (val != null) {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingDataModel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingDataModel.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingDataModel.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingDataModel.java Fri Jun 10 21:58:14 2011
@@ -26,6 +26,7 @@ import java.io.PrintWriter;
 import java.util.regex.Pattern;
 
 import com.google.common.base.Charsets;
+import com.google.common.io.Closeables;
 import org.apache.mahout.cf.taste.example.grouplens.GroupLensDataModel;
 import org.apache.mahout.cf.taste.impl.model.file.FileDataModel;
 import org.apache.mahout.common.iterator.FileLineIterable;
@@ -85,7 +86,7 @@ public final class BookCrossingDataModel
       resultFile.delete();
       throw ioe;
     } finally {
-      IOUtils.quietClose(writer);
+      Closeables.closeQuietly(writer);
     }
     return resultFile;
   }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensDataModel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensDataModel.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensDataModel.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensDataModel.java Fri Jun 10 21:58:14 2011
@@ -27,6 +27,7 @@ import java.net.URL;
 import java.util.regex.Pattern;
 
 import com.google.common.base.Charsets;
+import com.google.common.io.Closeables;
 import com.google.common.io.Files;
 import com.google.common.io.InputSupplier;
 import com.google.common.io.Resources;
@@ -69,12 +70,11 @@ public final class GroupLensDataModel ex
         String convertedLine = COLON_DELIMITER_PATTERN.matcher(subLine).replaceAll(",");
         writer.println(convertedLine);
       }
-      writer.flush();
     } catch (IOException ioe) {
       resultFile.delete();
       throw ioe;
     } finally {
-      IOUtils.quietClose(writer);
+      Closeables.closeQuietly(writer);
     }
     return resultFile;
   }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/jester/JesterDataModel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/jester/JesterDataModel.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/jester/JesterDataModel.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/jester/JesterDataModel.java Fri Jun 10 21:58:14 2011
@@ -19,10 +19,10 @@ package org.apache.mahout.cf.taste.examp
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.regex.Pattern;
 
+import com.google.common.collect.Lists;
 import org.apache.mahout.cf.taste.example.grouplens.GroupLensDataModel;
 import org.apache.mahout.cf.taste.impl.common.FastByIDMap;
 import org.apache.mahout.cf.taste.impl.model.GenericDataModel;
@@ -73,7 +73,7 @@ public final class JesterDataModel exten
     FastByIDMap<Collection<Preference>> data = (FastByIDMap<Collection<Preference>>) rawData;
     String[] jokePrefs = COMMA_PATTERN.split(line);
     int count = Integer.parseInt(jokePrefs[0]);
-    Collection<Preference> prefs = new ArrayList<Preference>(count);
+    Collection<Preference> prefs = Lists.newArrayListWithCapacity(count);
     for (int itemID = 1; itemID < jokePrefs.length; itemID++) { // yes skip first one, just a count
       String jokePref = jokePrefs[itemID];
       if (!"99".equals(jokePref)) {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/Track1RecommenderEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/Track1RecommenderEvaluator.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/Track1RecommenderEvaluator.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/Track1RecommenderEvaluator.java Fri Jun 10 21:58:14 2011
@@ -18,11 +18,11 @@
 package org.apache.mahout.cf.taste.example.kddcup.track1;
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import com.google.common.collect.Lists;
 import org.apache.mahout.cf.taste.common.TasteException;
 import org.apache.mahout.cf.taste.eval.DataModelBuilder;
 import org.apache.mahout.cf.taste.eval.RecommenderBuilder;
@@ -67,7 +67,7 @@ public final class Track1RecommenderEval
 
     Recommender recommender = recommenderBuilder.buildRecommender(dataModel);
 
-    Collection<Callable<Void>> estimateCallables = new ArrayList<Callable<Void>>();
+    Collection<Callable<Void>> estimateCallables = Lists.newArrayList();
     AtomicInteger noEstimateCounter = new AtomicInteger();
     for (Pair<PreferenceArray,long[]> userData :
          new DataFileIterable(KDDCupDataModel.getValidationFile(dataFileDirectory))) {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/Track1Runner.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/Track1Runner.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/Track1Runner.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/Track1Runner.java Fri Jun 10 21:58:14 2011
@@ -21,13 +21,13 @@ import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.OutputStream;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
+import com.google.common.collect.Lists;
 import com.google.common.io.Closeables;
 import org.apache.mahout.cf.taste.example.kddcup.DataFileIterable;
 import org.apache.mahout.cf.taste.example.kddcup.KDDCupDataModel;
@@ -65,7 +65,7 @@ public final class Track1Runner {
     log.info("Loaded model in {}s", (end - start) / 1000);
     start = end;
 
-    Collection<Track1Callable> callables = new ArrayList<Track1Callable>();
+    Collection<Track1Callable> callables = Lists.newArrayList();
     for (Pair<PreferenceArray,long[]> tests : new DataFileIterable(KDDCupDataModel.getTestFile(dataFileDirectory))) {
       PreferenceArray userTest = tests.getFirst();
       callables.add(new Track1Callable(recommender, userTest));

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/svd/DataModelFactorizablePreferences.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/svd/DataModelFactorizablePreferences.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/svd/DataModelFactorizablePreferences.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/svd/DataModelFactorizablePreferences.java Fri Jun 10 21:58:14 2011
@@ -17,13 +17,13 @@
 
 package org.apache.mahout.cf.taste.example.kddcup.track1.svd;
 
+import com.google.common.collect.Lists;
 import org.apache.mahout.cf.taste.impl.common.FastIDSet;
 import org.apache.mahout.cf.taste.impl.common.LongPrimitiveIterator;
 import org.apache.mahout.cf.taste.impl.model.GenericPreference;
 import org.apache.mahout.cf.taste.model.DataModel;
 import org.apache.mahout.cf.taste.model.Preference;
 
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -47,7 +47,7 @@ public class DataModelFactorizablePrefer
     try {
       userIDs = new FastIDSet(dataModel.getNumUsers());
       itemIDs = new FastIDSet(dataModel.getNumItems());
-      preferences = new ArrayList<Preference>();
+      preferences = Lists.newArrayList();
 
       LongPrimitiveIterator userIDsIterator = dataModel.getUserIDs();
       while (userIDsIterator.hasNext()) {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/Track2Callable.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/Track2Callable.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/Track2Callable.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/Track2Callable.java Fri Jun 10 21:58:14 2011
@@ -17,7 +17,6 @@
 
 package org.apache.mahout.cf.taste.example.kddcup.track2;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -26,6 +25,7 @@ import java.util.TreeMap;
 import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import com.google.common.collect.Lists;
 import org.apache.mahout.cf.taste.common.NoSuchItemException;
 import org.apache.mahout.cf.taste.common.TasteException;
 import org.apache.mahout.cf.taste.model.PreferenceArray;
@@ -73,7 +73,7 @@ final class Track2Callable implements Ca
     }
 
     Collection<Long> itemIDs = estimateToItemID.values();
-    List<Long> topThree = new ArrayList<Long>(itemIDs);
+    List<Long> topThree = Lists.newArrayList(itemIDs);
     if (topThree.size() > 3) {
       topThree = topThree.subList(0, 3);
     } else if (topThree.size() < 3) {
@@ -86,7 +86,7 @@ final class Track2Callable implements Ca
         newItemIDs.add(userTest.getItemID(i));
         i++;
       }
-      topThree = new ArrayList<Long>(newItemIDs);
+      topThree = Lists.newArrayList(newItemIDs);
     }
     if (topThree.size() != 3) {
       throw new IllegalStateException();

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/Track2Runner.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/Track2Runner.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/Track2Runner.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/Track2Runner.java Fri Jun 10 21:58:14 2011
@@ -21,13 +21,13 @@ import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.OutputStream;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
+import com.google.common.collect.Lists;
 import com.google.common.io.Closeables;
 import org.apache.mahout.cf.taste.example.kddcup.DataFileIterable;
 import org.apache.mahout.cf.taste.example.kddcup.KDDCupDataModel;
@@ -65,7 +65,7 @@ public final class Track2Runner {
     log.info("Loaded model in {}s", (end - start) / 1000);
     start = end;
 
-    Collection<Track2Callable> callables = new ArrayList<Track2Callable>();
+    Collection<Track2Callable> callables = Lists.newArrayList();
     for (Pair<PreferenceArray,long[]> tests : new DataFileIterable(KDDCupDataModel.getTestFile(dataFileDirectory))) {
       PreferenceArray userTest = tests.getFirst();
       callables.add(new Track2Callable(recommender, userTest));

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixDataModel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixDataModel.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixDataModel.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixDataModel.java Fri Jun 10 21:58:14 2011
@@ -20,11 +20,11 @@ package org.apache.mahout.cf.taste.examp
 import java.io.File;
 import java.io.FilenameFilter;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import org.apache.mahout.cf.taste.common.Refreshable;
 import org.apache.mahout.cf.taste.common.TasteException;
 import org.apache.mahout.cf.taste.impl.common.FastByIDMap;
@@ -91,7 +91,7 @@ public final class NetflixDataModel impl
         float rating = Float.parseFloat(line.substring(firstComma + 1, secondComma));
         Collection<Preference> userPrefs = userIDPrefMap.get(userID);
         if (userPrefs == null) {
-          userPrefs = new ArrayList<Preference>(2);
+          userPrefs = Lists.newArrayListWithCapacity(2);
           userIDPrefMap.put(userID, userPrefs);
         }
         userPrefs.add(new GenericPreference(userID, movieID, rating));

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixFileDataModel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixFileDataModel.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixFileDataModel.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixFileDataModel.java Fri Jun 10 21:58:14 2011
@@ -19,12 +19,12 @@ package org.apache.mahout.cf.taste.examp
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.NoSuchElementException;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import org.apache.mahout.cf.taste.common.Refreshable;
 import org.apache.mahout.cf.taste.common.TasteException;
 import org.apache.mahout.cf.taste.impl.common.AbstractLongPrimitiveIterator;
@@ -84,7 +84,7 @@ public final class NetflixFileDataModel 
     while (itemIDPadded.length() < 5) {
       itemIDPadded.insert(0, '0');
     }
-    List<Preference> prefs = new ArrayList<Preference>();
+    List<Preference> prefs = Lists.newArrayList();
     File movieFile = new File(new File(dataDirectory, "training_set"), "mv_00" + itemIDPadded + ".txt");
     try {
       for (String line : new FileLineIterable(movieFile, true)) {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java Fri Jun 10 21:58:14 2011
@@ -22,13 +22,14 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
 import com.google.common.base.Charsets;
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.io.Closeables;
 import org.apache.commons.cli2.OptionException;
 import org.apache.mahout.cf.taste.example.TasteOptionParser;
 import org.apache.mahout.cf.taste.impl.common.FastMap;
@@ -72,7 +73,7 @@ public final class TransposeToByUser {
         String ratingString = line.substring(firstComma, secondComma); // keep comma
         List<String> cachedLines = byUserEntryCache.get(userIDString);
         if (cachedLines == null) {
-          cachedLines = new ArrayList<String>();
+          cachedLines = Lists.newArrayList();
           byUserEntryCache.put(userIDString, cachedLines);
         }
         cachedLines.add(movieIDString + ratingString);
@@ -108,7 +109,7 @@ public final class TransposeToByUser {
         outputStreamWriter.println(s);
       }
     } finally {
-      IOUtils.quietClose(outputStreamWriter);
+      Closeables.closeQuietly(outputStreamWriter);
     }
   }
   

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/SplitBayesInput.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/SplitBayesInput.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/SplitBayesInput.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/SplitBayesInput.java Fri Jun 10 21:58:14 2011
@@ -27,6 +27,7 @@ import java.util.BitSet;
 
 import com.google.common.base.Charsets;
 import com.google.common.base.Preconditions;
+import com.google.common.io.Closeables;
 import org.apache.commons.cli2.CommandLine;
 import org.apache.commons.cli2.Group;
 import org.apache.commons.cli2.Option;
@@ -380,9 +381,9 @@ public class SplitBayesInput {
       }
 
     } finally {
-      IOUtils.quietClose(reader);
-      IOUtils.quietClose(trainingWriter);
-      IOUtils.quietClose(testWriter);
+      Closeables.closeQuietly(reader);
+      Closeables.closeQuietly(trainingWriter);
+      Closeables.closeQuietly(testWriter);
     }
     
     log.info("file: {}, input: {} train: {}, test: {} starting at {}",
@@ -572,13 +573,13 @@ public class SplitBayesInput {
    */
   public static int countLines(FileSystem fs, Path inputFile, Charset charset) throws IOException {
     int lineCount = 0;
-    BufferedReader countReader = new BufferedReader(new InputStreamReader(fs.open(inputFile), charset));
+    BufferedReader reader = new BufferedReader(new InputStreamReader(fs.open(inputFile), charset));
     try {
-      while (countReader.readLine() != null) {
+      while (reader.readLine() != null) {
         lineCount++;
       }
     } finally {
-      IOUtils.quietClose(countReader);
+      Closeables.closeQuietly(reader);
     }
     
     return lineCount;

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/WikipediaDatasetCreatorMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/WikipediaDatasetCreatorMapper.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/WikipediaDatasetCreatorMapper.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/WikipediaDatasetCreatorMapper.java Fri Jun 10 21:58:14 2011
@@ -19,13 +19,13 @@ package org.apache.mahout.classifier.bay
 
 import java.io.IOException;
 import java.io.StringReader;
-import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Set;
 import java.util.regex.Pattern;
 
+import com.google.common.collect.Lists;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.DefaultStringifier;
@@ -91,8 +91,8 @@ public class WikipediaDatasetCreatorMapp
           new DefaultStringifier<Set<String>>(conf, GenericsUtil.getClass(newCategories));
       String categoriesStr = conf.get("wikipedia.categories", setStringifier.toString(newCategories));
       Set<String> inputCategoriesSet = setStringifier.fromString(categoriesStr);
-      inputCategories = new ArrayList<String>(inputCategoriesSet);
-      inputCategoryPatterns = new ArrayList<Pattern>(inputCategories.size());
+      inputCategories = Lists.newArrayList(inputCategoriesSet);
+      inputCategoryPatterns = Lists.newArrayListWithCapacity(inputCategories.size());
       for (String inputCategory : inputCategories) {
         inputCategoryPatterns.add(Pattern.compile(".*\\b" + inputCategory + "\\b.*"));
       }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sequencelearning/hmm/PosTagger.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sequencelearning/hmm/PosTagger.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sequencelearning/hmm/PosTagger.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sequencelearning/hmm/PosTagger.java Fri Jun 10 21:58:14 2011
@@ -20,13 +20,13 @@ package org.apache.mahout.classifier.seq
 import java.io.IOException;
 import java.net.URL;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
 
 import com.google.common.base.Charsets;
+import com.google.common.collect.Maps;
 import com.google.common.io.CharStreams;
 import com.google.common.io.Resources;
 import org.apache.mahout.math.Matrix;
@@ -177,8 +177,8 @@ public final class PosTagger {
   }
 
   private static void trainModel(String trainingURL) throws IOException {
-    tagIDs = new HashMap<String, Integer>(44); // we expect 44 distinct tags
-    wordIDs = new HashMap<String, Integer>(19122); // we expect 19122
+    tagIDs = Maps.newHashMapWithExpectedSize(44); // we expect 44 distinct tags
+    wordIDs = Maps.newHashMapWithExpectedSize(19122); // we expect 19122
     // distinct words
     log.info("Reading and parsing training data file from URL: {}", trainingURL);
     long start = System.currentTimeMillis();

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/LogisticModelParameters.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/LogisticModelParameters.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/LogisticModelParameters.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/LogisticModelParameters.java Fri Jun 10 21:58:14 2011
@@ -18,6 +18,7 @@
 package org.apache.mahout.classifier.sgd;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.io.Closeables;
 import org.apache.hadoop.io.Writable;
@@ -31,8 +32,6 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -148,7 +147,7 @@ public class LogisticModelParameters imp
   public void readFields(DataInput in) throws IOException {
     targetVariable = in.readUTF();
     int typeMapSize = in.readInt();
-    typeMap = new HashMap<String,String>(typeMapSize);
+    typeMap = Maps.newHashMapWithExpectedSize(typeMapSize);
     for (int i = 0; i < typeMapSize; i++) {
       String key = in.readUTF();
       String value = in.readUTF();
@@ -158,7 +157,7 @@ public class LogisticModelParameters imp
     useBias = in.readBoolean();
     maxTargetCategories = in.readInt();
     int targetCategoriesSize = in.readInt();
-    targetCategories = new ArrayList<String>(targetCategoriesSize);
+    targetCategories = Lists.newArrayListWithCapacity(targetCategoriesSize);
     for (int i = 0; i < targetCategoriesSize; i++) {
       targetCategories.add(in.readUTF());
     }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java Fri Jun 10 21:58:14 2011
@@ -88,7 +88,7 @@ public final class SimpleCsvExamples {
           out.println(x);
         }
       } finally {
-        IOUtils.quietClose(out);
+        Closeables.closeQuietly(out);
       }
     } else if ("--parse".equals(args[0])) {
       BufferedReader in = Files.newReader(new File(args[1]), Charsets.UTF_8);
@@ -104,7 +104,7 @@ public final class SimpleCsvExamples {
           line = in.readLine();
         }
       } finally {
-        IOUtils.quietClose(in);
+        Closeables.closeQuietly(in);
       }
       String separator = "";
       for (int i = 0; i < FIELDS; i++) {
@@ -125,7 +125,7 @@ public final class SimpleCsvExamples {
           line = in.read();
         }
       } finally {
-        IOUtils.quietClose(in);
+        Closeables.closeQuietly(in);
       }
       String separator = "";
       for (int i = 0; i < FIELDS; i++) {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayClustering.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayClustering.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayClustering.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayClustering.java Fri Jun 10 21:58:14 2011
@@ -29,10 +29,10 @@ import java.awt.geom.AffineTransform;
 import java.awt.geom.Ellipse2D;
 import java.awt.geom.Rectangle2D;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import com.google.common.io.Closeables;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -63,11 +63,11 @@ public class DisplayClustering extends F
 
   protected static final int SIZE = 8; // screen size in inches
 
-  private static final Collection<Vector> SAMPLE_PARAMS = new ArrayList<Vector>();
+  private static final Collection<Vector> SAMPLE_PARAMS = Lists.newArrayList();
 
-  protected static final List<VectorWritable> SAMPLE_DATA = new ArrayList<VectorWritable>();
+  protected static final List<VectorWritable> SAMPLE_DATA = Lists.newArrayList();
 
-  protected static final List<List<Cluster>> CLUSTERS = new ArrayList<List<Cluster>>();
+  protected static final List<List<Cluster>> CLUSTERS = Lists.newArrayList();
 
   static final Color[] COLORS = {
     Color.red, Color.orange, Color.yellow, Color.green, Color.blue, Color.magenta, Color.lightGray
@@ -249,7 +249,7 @@ public class DisplayClustering extends F
   }
 
   protected static List<Cluster> readClusters(Path clustersIn) {
-    List<Cluster> clusters = new ArrayList<Cluster>();
+    List<Cluster> clusters = Lists.newArrayList();
     Configuration conf = new Configuration();
     for (Cluster value :
          new SequenceFileDirValueIterable<Cluster>(clustersIn, PathType.LIST, PathFilters.logsCRCFilter(), conf)) {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayDirichlet.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayDirichlet.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayDirichlet.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayDirichlet.java Fri Jun 10 21:58:14 2011
@@ -20,9 +20,9 @@ package org.apache.mahout.clustering.dis
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.mahout.clustering.Cluster;
@@ -91,7 +91,7 @@ public class DisplayDirichlet extends Di
   private static void runSequentialDirichletClassifier(ModelDistribution<VectorWritable> modelDist,
                                                        int numClusters,
                                                        int numIterations) throws IOException {
-    List<Cluster> models = new ArrayList<Cluster>();
+    List<Cluster> models = Lists.newArrayList();
     for (Model<VectorWritable> cluster : modelDist.sampleFromPrior(numClusters)) {
       models.add((Cluster) cluster);
     }
@@ -106,7 +106,7 @@ public class DisplayDirichlet extends Di
     new ClusterIterator(policy).iterate(samples, priorClassifier, output, numIterations);
     for (int i = 1; i <= numIterations; i++) {
       ClusterClassifier posterior = readClassifier(conf, new Path(output, "classifier-" + i));
-      List<Cluster> clusters = new ArrayList<Cluster>();    
+      List<Cluster> clusters = Lists.newArrayList();
       for (Cluster cluster : posterior.getModels()) {
         if (isSignificant(cluster)) {
           clusters.add(cluster);
@@ -126,7 +126,7 @@ public class DisplayDirichlet extends Di
     List<Cluster[]> result = dc.cluster(numIterations);
     printModels(result, burnin);
     for (Cluster[] models : result) {
-      List<Cluster> clusters = new ArrayList<Cluster>();
+      List<Cluster> clusters = Lists.newArrayList();
       for (Cluster cluster : models) {
         if (isSignificant(cluster)) {
           clusters.add(cluster);

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayFuzzyKMeans.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayFuzzyKMeans.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayFuzzyKMeans.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayFuzzyKMeans.java Fri Jun 10 21:58:14 2011
@@ -20,10 +20,10 @@ package org.apache.mahout.clustering.dis
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.mahout.clustering.Cluster;
@@ -83,11 +83,11 @@ public class DisplayFuzzyKMeans extends 
                                                     DistanceMeasure measure,
                                                     int numClusters,
                                                     int maxIterations) throws IOException {
-    Collection<Vector> points = new ArrayList<Vector>();
+    Collection<Vector> points = Lists.newArrayList();
     for (int i = 0; i < numClusters; i++) {
       points.add(SAMPLE_DATA.get(i).get());
     }
-    List<Cluster> initialClusters = new ArrayList<Cluster>();
+    List<Cluster> initialClusters = Lists.newArrayList();
     int id = 0;
     for (Vector point : points) {
       initialClusters.add(new SoftCluster(point, id++, measure));

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayKMeans.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayKMeans.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayKMeans.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayKMeans.java Fri Jun 10 21:58:14 2011
@@ -20,10 +20,10 @@ package org.apache.mahout.clustering.dis
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.mahout.clustering.Cluster;
@@ -73,11 +73,11 @@ public class DisplayKMeans extends Displ
                                                     Path output,
                                                     DistanceMeasure measure,
                                                     int numClusters) throws IOException {
-    Collection<Vector> points = new ArrayList<Vector>();
+    Collection<Vector> points = Lists.newArrayList();
     for (int i = 0; i < numClusters; i++) {
       points.add(SAMPLE_DATA.get(i).get());
     }
-    List<Cluster> initialClusters = new ArrayList<Cluster>();
+    List<Cluster> initialClusters = Lists.newArrayList();
     int id = 0;
     for (Vector point : points) {
       initialClusters.add(new org.apache.mahout.clustering.kmeans.Cluster(

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmClusterEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmClusterEvaluator.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmClusterEvaluator.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmClusterEvaluator.java Fri Jun 10 21:58:14 2011
@@ -18,12 +18,13 @@
 package org.apache.mahout.clustering.minhash;
 
 import java.text.NumberFormat;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Random;
 import java.util.Set;
 import java.util.HashSet;
+
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
@@ -90,7 +91,7 @@ public final class LastfmClusterEvaluato
     Configuration conf = new Configuration();
     Random rand = RandomUtils.getRandom();
     Text prevCluster = new Text();
-    List<List<Integer>> listenerVectors = new ArrayList<List<Integer>>();
+    List<List<Integer>> listenerVectors = Lists.newArrayList();
     long similarListeners = 0;
     long allListeners = 0;
     int clustersProcessed = 0;
@@ -121,7 +122,7 @@ public final class LastfmClusterEvaluato
         clustersProcessed++;
         System.out.print('\r' + usedMemory() + " Clusters processed: " + clustersProcessed);
       }
-      List<Integer> listeners = new ArrayList<Integer>();
+      List<Integer> listeners = Lists.newArrayList();
       for (Vector.Element ele : point.get()) {
         listeners.add((int) ele.get());
       }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmDataConverter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmDataConverter.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmDataConverter.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmDataConverter.java Fri Jun 10 21:58:14 2011
@@ -18,6 +18,8 @@
 package org.apache.mahout.clustering.minhash;
 
 import com.google.common.base.Charsets;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.google.common.io.Closeables;
 import com.google.common.io.Files;
 import org.apache.hadoop.conf.Configuration;
@@ -32,8 +34,6 @@ import org.apache.mahout.math.VectorWrit
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
@@ -96,8 +96,8 @@ public final class LastfmDataConverter {
    */
   public static Map<String, List<Integer>> convertToItemFeatures(String inputFile, Lastfm dataSet) throws IOException {
     long totalRecords = dataSet.totalRecords;
-    Map<String, Integer> featureIdxMap = new HashMap<String, Integer>();
-    Map<String, List<Integer>> itemFeaturesMap = new HashMap<String, List<Integer>>();
+    Map<String, Integer> featureIdxMap = Maps.newHashMap();
+    Map<String, List<Integer>> itemFeaturesMap = Maps.newHashMap();
     String msg = usedMemory() + "Converting data to internal vector format: ";
     BufferedReader br = Files.newReader(new File(inputFile), Charsets.UTF_8);
     try {
@@ -119,7 +119,7 @@ public final class LastfmDataConverter {
         // add it to the corresponding feature idx map
         List<Integer> features = itemFeaturesMap.get(item);
         if (features == null) {
-          features = new ArrayList<Integer>();
+          features = Lists.newArrayList();
           itemFeaturesMap.put(item, features);
         }
         features.add(featureIdx);

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java Fri Jun 10 21:58:14 2011
@@ -20,8 +20,6 @@ package org.apache.mahout.clustering.syn
 import java.io.IOException;
 import java.util.Map;
 
-import org.apache.commons.cli2.builder.ArgumentBuilder;
-import org.apache.commons.cli2.builder.DefaultOptionBuilder;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.util.ToolRunner;

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/dataset/KeyBasedStringTupleMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/dataset/KeyBasedStringTupleMapper.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/dataset/KeyBasedStringTupleMapper.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/dataset/KeyBasedStringTupleMapper.java Fri Jun 10 21:58:14 2011
@@ -18,11 +18,11 @@
 package org.apache.mahout.fpm.pfpgrowth.dataset;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.regex.Pattern;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapreduce.Mapper;
@@ -53,13 +53,13 @@ public class KeyBasedStringTupleMapper e
       context.getCounter("Map", "ERROR").increment(1);
       return;
     }
-    Collection<String> oKey = new ArrayList<String>();
+    Collection<String> oKey = Lists.newArrayList();
     for (int groupingField : groupingFields) {
       oKey.add(fields[groupingField]);
       context.setStatus(fields[groupingField]);
     }
     
-    List<String> oValue = new ArrayList<String>();
+    List<String> oValue = Lists.newArrayList();
     for (int selectedField : selectedFields) {
       oValue.add(fields[selectedField]);
     }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDCrossover.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDCrossover.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDCrossover.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDCrossover.java Fri Jun 10 21:58:14 2011
@@ -17,11 +17,11 @@
 
 package org.apache.mahout.ga.watchmaker.cd;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import org.uncommons.maths.random.Probability;
 import org.uncommons.watchmaker.framework.operators.AbstractCrossover;
 
@@ -56,7 +56,7 @@ public class CDCrossover extends Abstrac
       }
     }
     
-    List<CDRule> result = new ArrayList<CDRule>(2);
+    List<CDRule> result = Lists.newArrayListWithCapacity(2);
     result.add(offspring1);
     result.add(offspring2);
     return result;

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDFitnessEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDFitnessEvaluator.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDFitnessEvaluator.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDFitnessEvaluator.java Fri Jun 10 21:58:14 2011
@@ -18,10 +18,10 @@
 package org.apache.mahout.ga.watchmaker.cd;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.fs.Path;
 import org.apache.mahout.ga.watchmaker.STFitnessEvaluator;
 import org.apache.mahout.ga.watchmaker.cd.hadoop.CDMahoutEvaluator;
@@ -37,7 +37,7 @@ public class CDFitnessEvaluator extends 
   
   private final DatasetSplit split;
   
-  private final Collection<CDFitness> evals = new ArrayList<CDFitness>();
+  private final Collection<CDFitness> evals = Lists.newArrayList();
   
   private final int target;
   

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java Fri Jun 10 21:58:14 2011
@@ -18,9 +18,9 @@
 package org.apache.mahout.ga.watchmaker.cd;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.commons.cli2.CommandLine;
 import org.apache.commons.cli2.Group;
 import org.apache.commons.cli2.Option;
@@ -174,7 +174,7 @@ public final class CDGA {
     CandidateFactory<CDRule> factory = new CDFactory(threshold);
 
     // Evolution Scheme
-    List<EvolutionaryOperator<CDRule>> operators = new ArrayList<EvolutionaryOperator<CDRule>>();
+    List<EvolutionaryOperator<CDRule>> operators = Lists.newArrayList();
     operators.add(new CDCrossover(crosspnts));
     operators.add(new CDMutation(mutrate, mutrange, mutprec));
     EvolutionPipeline<CDRule> pipeline = new EvolutionPipeline<CDRule>(operators);

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDMutation.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDMutation.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDMutation.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDMutation.java Fri Jun 10 21:58:14 2011
@@ -17,11 +17,11 @@
 
 package org.apache.mahout.ga.watchmaker.cd;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import org.uncommons.watchmaker.framework.EvolutionaryOperator;
 
 /**
@@ -61,7 +61,7 @@ public class CDMutation implements Evolu
   
   @Override
   public List<CDRule> apply(List<CDRule> selectedCandidates, Random rng) {
-    List<CDRule> mutatedPopulation = new ArrayList<CDRule>(selectedCandidates.size());
+    List<CDRule> mutatedPopulation = Lists.newArrayListWithCapacity(selectedCandidates.size());
     for (CDRule ind : selectedCandidates) {
       mutatedPopulation.add(mutate(ind, rng));
     }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/DataLine.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/DataLine.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/DataLine.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/DataLine.java Fri Jun 10 21:58:14 2011
@@ -17,7 +17,8 @@
 
 package org.apache.mahout.ga.watchmaker.cd;
 
-import java.util.ArrayList;
+import com.google.common.collect.Lists;
+
 import java.util.List;
 import java.util.StringTokenizer;
 
@@ -52,7 +53,7 @@ public class DataLine {
     
     // extract tokens
     StringTokenizer tokenizer = new StringTokenizer(dlstr, ",");
-    List<String> tokens = new ArrayList<String>();
+    List<String> tokens = Lists.newArrayList();
     while (tokenizer.hasMoreTokens()) {
       tokens.add(tokenizer.nextToken());
     }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/FileInfoParser.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/FileInfoParser.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/FileInfoParser.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/FileInfoParser.java Fri Jun 10 21:58:14 2011
@@ -18,7 +18,6 @@
 package org.apache.mahout.ga.watchmaker.cd;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
@@ -26,6 +25,7 @@ import java.util.Scanner;
 
 import com.google.common.base.Preconditions;
 import com.google.common.base.Splitter;
+import com.google.common.collect.Lists;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -69,8 +69,8 @@ public final class FileInfoParser {
     FSDataInputStream input = fs.open(info);
     Scanner reader = new Scanner(input);
     
-    List<Integer> ignored = new ArrayList<Integer>();
-    List<Attribute> attributes = new ArrayList<Attribute>();
+    List<Integer> ignored = Lists.newArrayList();
+    List<Attribute> attributes = Lists.newArrayList();
     int labelIndex = -1;
     
     int index = 0;
@@ -121,7 +121,7 @@ public final class FileInfoParser {
    * Parse a nominal attribute.
    */
   private static NominalAttr parseNominal(Iterator<String> tokens) {
-    Collection<String> vlist = new ArrayList<String>();
+    Collection<String> vlist = Lists.newArrayList();
     while (tokens.hasNext()) {
       vlist.add(tokens.next());
     }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluator.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluator.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluator.java Fri Jun 10 21:58:14 2011
@@ -18,12 +18,12 @@
 package org.apache.mahout.ga.watchmaker.cd.hadoop;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -106,7 +106,7 @@ public final class CDMahoutEvaluator {
    */
   public static CDFitness evaluate(Rule rule, int target, Path inpath, Path output, DatasetSplit split)
     throws IOException, InterruptedException, ClassNotFoundException {
-    List<CDFitness> evals = new ArrayList<CDFitness>();
+    List<CDFitness> evals = Lists.newArrayList();
 
     evaluate(Arrays.asList(rule), target, inpath, output, evals, split);
 

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosTool.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosTool.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosTool.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosTool.java Fri Jun 10 21:58:14 2011
@@ -20,13 +20,13 @@ package org.apache.mahout.ga.watchmaker.
 import java.io.BufferedWriter;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Locale;
 import java.util.Scanner;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import com.google.common.io.Closeables;
 import org.apache.commons.cli2.CommandLine;
 import org.apache.commons.cli2.Group;
@@ -155,7 +155,7 @@ public final class CDInfosTool {
     FSDataInputStream input = fs.open(infpath);
     Scanner reader = new Scanner(input);
 
-    List<Character> descriptors = new ArrayList<Character>();
+    List<Character> descriptors = Lists.newArrayList();
 
     while (reader.hasNextLine()) {
       String c = reader.nextLine();
@@ -238,7 +238,7 @@ public final class CDInfosTool {
       Descriptors descriptors = loadDescriptors(fs, input);
 
       log.info("Gathering informations...");
-      List<String> descriptions = new ArrayList<String>();
+      List<String> descriptions = Lists.newArrayList();
       gatherInfos(descriptors, input, output, descriptions);
 
       log.info("Storing Descriptions...");

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/ToolMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/ToolMapper.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/ToolMapper.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/ToolMapper.java Fri Jun 10 21:58:14 2011
@@ -18,11 +18,11 @@
 package org.apache.mahout.ga.watchmaker.cd.tool;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Pattern;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapreduce.Mapper;
@@ -86,7 +86,7 @@ public class ToolMapper extends Mapper<L
    * attributes.
    */
   static List<String> extractAttributes(Text value) {
-    List<String> result = new ArrayList<String>();
+    List<String> result = Lists.newArrayList();
     for (String token : COMMA.split(value.toString())) {
       result.add(token.trim());
     }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/BruteForceTravellingSalesman.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/BruteForceTravellingSalesman.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/BruteForceTravellingSalesman.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/BruteForceTravellingSalesman.java Fri Jun 10 21:58:14 2011
@@ -17,11 +17,11 @@
 
 package org.apache.mahout.ga.watchmaker.travellingsalesman;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.uncommons.maths.combinatorics.PermutationGenerator;
 import org.uncommons.watchmaker.framework.FitnessEvaluator;
 
@@ -65,7 +65,7 @@ public class BruteForceTravellingSalesma
   public List<String> calculateShortestRoute(Collection<String> cities, ProgressListener progressListener) {
     Iterator<String> iterator = cities.iterator();
     String startCity = iterator.next();
-    Collection<String> destinations = new ArrayList<String>(cities.size() - 1);
+    Collection<String> destinations = Lists.newArrayListWithCapacity(cities.size() - 1);
     while (iterator.hasNext()) {
       destinations.add(iterator.next());
     }
@@ -76,14 +76,14 @@ public class BruteForceTravellingSalesma
     long count = 0;
     List<String> shortestRoute = null;
     double shortestDistance = Double.POSITIVE_INFINITY;
-    List<String> currentRoute = new ArrayList<String>(cities.size());
+    List<String> currentRoute = Lists.newArrayListWithCapacity(cities.size());
     while (generator.hasMore()) {
       List<String> route = generator.nextPermutationAsList(currentRoute);
       route.add(0, startCity);
       double distance = evaluator.getFitness(route, null);
       if (distance < shortestDistance) {
         shortestDistance = distance;
-        shortestRoute = new ArrayList<String>(route);
+        shortestRoute = Lists.newArrayList(route);
       }
       ++count;
       if (count % 1000 == 0 && progressListener != null) {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/EuropeanDistanceLookup.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/EuropeanDistanceLookup.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/EuropeanDistanceLookup.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/EuropeanDistanceLookup.java Fri Jun 10 21:58:14 2011
@@ -17,7 +17,9 @@
 
 package org.apache.mahout.ga.watchmaker.travellingsalesman;
 
-import java.util.ArrayList;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -34,7 +36,7 @@ public final class EuropeanDistanceLooku
   static {
     // Distances are in km as the crow flies (from http://www.indo.com/distance/)
     
-    Map<String,Integer> amsterdam = new HashMap<String,Integer>(20);
+    Map<String,Integer> amsterdam = Maps.newHashMapWithExpectedSize(20);
     amsterdam.put("Amsterdam", 0);
     amsterdam.put("Athens", 2162);
     amsterdam.put("Berlin", 576);
@@ -52,7 +54,7 @@ public final class EuropeanDistanceLooku
     amsterdam.put("Vienna", 938);
     EuropeanDistanceLookup.DISTANCES.put("Amsterdam", amsterdam);
     
-    Map<String,Integer> athens = new HashMap<String,Integer>(20);
+    Map<String,Integer> athens = Maps.newHashMapWithExpectedSize(20);
     athens.put("Amsterdam", 2162);
     athens.put("Athens", 0);
     athens.put("Berlin", 1801);
@@ -70,7 +72,7 @@ public final class EuropeanDistanceLooku
     athens.put("Vienna", 1280);
     EuropeanDistanceLookup.DISTANCES.put("Athens", athens);
     
-    Map<String,Integer> berlin = new HashMap<String,Integer>(20);
+    Map<String,Integer> berlin = Maps.newHashMapWithExpectedSize(20);
     berlin.put("Amsterdam", 576);
     berlin.put("Athens", 1801);
     berlin.put("Berlin", 0);
@@ -88,7 +90,7 @@ public final class EuropeanDistanceLooku
     berlin.put("Vienna", 525);
     EuropeanDistanceLookup.DISTANCES.put("Berlin", berlin);
     
-    Map<String,Integer> brussels = new HashMap<String,Integer>(20);
+    Map<String,Integer> brussels = Maps.newHashMapWithExpectedSize(20);
     brussels.put("Amsterdam", 171);
     brussels.put("Athens", 2089);
     brussels.put("Berlin", 648);
@@ -106,7 +108,7 @@ public final class EuropeanDistanceLooku
     brussels.put("Vienna", 917);
     EuropeanDistanceLookup.DISTANCES.put("Brussels", brussels);
     
-    Map<String,Integer> copenhagen = new HashMap<String,Integer>(20);
+    Map<String,Integer> copenhagen = Maps.newHashMapWithExpectedSize(20);
     copenhagen.put("Amsterdam", 622);
     copenhagen.put("Athens", 2140);
     copenhagen.put("Berlin", 361);
@@ -124,7 +126,7 @@ public final class EuropeanDistanceLooku
     copenhagen.put("Vienna", 876);
     EuropeanDistanceLookup.DISTANCES.put("Copenhagen", copenhagen);
     
-    Map<String,Integer> dublin = new HashMap<String,Integer>(20);
+    Map<String,Integer> dublin = Maps.newHashMapWithExpectedSize(20);
     dublin.put("Amsterdam", 757);
     dublin.put("Athens", 2860);
     dublin.put("Berlin", 1315);
@@ -142,7 +144,7 @@ public final class EuropeanDistanceLooku
     dublin.put("Vienna", 1687);
     EuropeanDistanceLookup.DISTANCES.put("Dublin", dublin);
     
-    Map<String,Integer> helsinki = new HashMap<String,Integer>(20);
+    Map<String,Integer> helsinki = Maps.newHashMapWithExpectedSize(20);
     helsinki.put("Amsterdam", 1506);
     helsinki.put("Athens", 2464);
     helsinki.put("Berlin", 1108);
@@ -160,7 +162,7 @@ public final class EuropeanDistanceLooku
     helsinki.put("Vienna", 1439);
     EuropeanDistanceLookup.DISTANCES.put("Helsinki", helsinki);
     
-    Map<String,Integer> lisbon = new HashMap<String,Integer>(20);
+    Map<String,Integer> lisbon = Maps.newHashMapWithExpectedSize(20);
     lisbon.put("Amsterdam", 1861);
     lisbon.put("Athens", 2854);
     lisbon.put("Berlin", 2310);
@@ -178,7 +180,7 @@ public final class EuropeanDistanceLooku
     lisbon.put("Vienna", 2300);
     EuropeanDistanceLookup.DISTANCES.put("Lisbon", lisbon);
     
-    Map<String,Integer> london = new HashMap<String,Integer>(20);
+    Map<String,Integer> london = Maps.newHashMapWithExpectedSize(20);
     london.put("Amsterdam", 356);
     london.put("Athens", 2391);
     london.put("Berlin", 929);
@@ -196,7 +198,7 @@ public final class EuropeanDistanceLooku
     london.put("Vienna", 1237);
     EuropeanDistanceLookup.DISTANCES.put("London", london);
     
-    Map<String,Integer> luxembourg = new HashMap<String,Integer>(20);
+    Map<String,Integer> luxembourg = Maps.newHashMapWithExpectedSize(20);
     luxembourg.put("Amsterdam", 318);
     luxembourg.put("Athens", 1901);
     luxembourg.put("Berlin", 595);
@@ -214,7 +216,7 @@ public final class EuropeanDistanceLooku
     luxembourg.put("Vienna", 761);
     EuropeanDistanceLookup.DISTANCES.put("Luxembourg", luxembourg);
     
-    Map<String,Integer> madrid = new HashMap<String,Integer>(20);
+    Map<String,Integer> madrid = Maps.newHashMapWithExpectedSize(20);
     madrid.put("Amsterdam", 1477);
     madrid.put("Athens", 2374);
     madrid.put("Berlin", 1866);
@@ -232,7 +234,7 @@ public final class EuropeanDistanceLooku
     madrid.put("Vienna", 1812);
     EuropeanDistanceLookup.DISTANCES.put("Madrid", madrid);
     
-    Map<String,Integer> paris = new HashMap<String,Integer>(20);
+    Map<String,Integer> paris = Maps.newHashMapWithExpectedSize(20);
     paris.put("Amsterdam", 429);
     paris.put("Athens", 2097);
     paris.put("Berlin", 877);
@@ -250,7 +252,7 @@ public final class EuropeanDistanceLooku
     paris.put("Vienna", 1037);
     EuropeanDistanceLookup.DISTANCES.put("Paris", paris);
     
-    Map<String,Integer> rome = new HashMap<String,Integer>(20);
+    Map<String,Integer> rome = Maps.newHashMapWithExpectedSize(20);
     rome.put("Amsterdam", 1304);
     rome.put("Athens", 1040);
     rome.put("Berlin", 1185);
@@ -268,7 +270,7 @@ public final class EuropeanDistanceLooku
     rome.put("Vienna", 765);
     EuropeanDistanceLookup.DISTANCES.put("Rome", rome);
     
-    Map<String,Integer> stockholm = new HashMap<String,Integer>(20);
+    Map<String,Integer> stockholm = Maps.newHashMapWithExpectedSize(20);
     stockholm.put("Amsterdam", 1132);
     stockholm.put("Athens", 2410);
     stockholm.put("Berlin", 818);
@@ -286,7 +288,7 @@ public final class EuropeanDistanceLooku
     stockholm.put("Vienna", 1247);
     EuropeanDistanceLookup.DISTANCES.put("Stockholm", stockholm);
     
-    Map<String,Integer> vienna = new HashMap<String,Integer>(20);
+    Map<String,Integer> vienna = Maps.newHashMapWithExpectedSize(20);
     vienna.put("Amsterdam", 938);
     vienna.put("Athens", 1280);
     vienna.put("Berlin", 525);
@@ -307,7 +309,7 @@ public final class EuropeanDistanceLooku
   
   @Override
   public List<String> getKnownCities() {
-    List<String> cities = new ArrayList<String>(EuropeanDistanceLookup.DISTANCES.keySet());
+    List<String> cities = Lists.newArrayList(EuropeanDistanceLookup.DISTANCES.keySet());
     Collections.sort(cities);
     return cities;
   }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/EvolutionaryTravellingSalesman.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/EvolutionaryTravellingSalesman.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/EvolutionaryTravellingSalesman.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/EvolutionaryTravellingSalesman.java Fri Jun 10 21:58:14 2011
@@ -17,13 +17,13 @@
 
 package org.apache.mahout.ga.watchmaker.travellingsalesman;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Random;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import org.apache.mahout.common.RandomUtils;
 import org.apache.mahout.ga.watchmaker.MahoutFitnessEvaluator;
 import org.uncommons.maths.random.PoissonGenerator;
@@ -131,7 +131,7 @@ public class EvolutionaryTravellingSales
     Random rng = RandomUtils.getRandom();
     
     // Set-up evolution pipeline (cross-over followed by mutation).
-    List<EvolutionaryOperator<List<String>>> operators = new ArrayList<EvolutionaryOperator<List<String>>>(2);
+    List<EvolutionaryOperator<List<String>>> operators = Lists.newArrayListWithCapacity(2);
     if (crossover) {
       operators.add(new ListOrderCrossover());
     }



Mime
View raw message