mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r1134456 [3/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/main/java/org/apache/mahout/clustering/kmeans/KMeansUtil.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansUtil.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansUtil.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansUtil.java Fri Jun 10 21:58:14 2011
@@ -18,9 +18,9 @@
 package org.apache.mahout.clustering.kmeans;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -43,7 +43,7 @@ final class KMeansUtil {
 
     // Get the path location where the cluster Info is stored
     Path clusterPath = new Path(clusterPathStr, "*");
-    Collection<Path> result = new ArrayList<Path>();
+    Collection<Path> result = Lists.newArrayList();
 
     // get all filtered file names in result list
     FileSystem fs = clusterPath.getFileSystem(conf);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java Fri Jun 10 21:58:14 2011
@@ -18,10 +18,10 @@
 package org.apache.mahout.clustering.kmeans;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
+import com.google.common.collect.Lists;
 import com.google.common.io.Closeables;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -76,8 +76,8 @@ public final class RandomSeedGenerator {
       FileStatus[] inputFiles = fs.globStatus(inputPathPattern, PathFilters.logsCRCFilter());
       SequenceFile.Writer writer = SequenceFile.createWriter(fs, conf, outFile, Text.class, Cluster.class);
       Random random = RandomUtils.getRandom();
-      List<Text> chosenTexts = new ArrayList<Text>(k);
-      List<Cluster> chosenClusters = new ArrayList<Cluster>(k);
+      List<Text> chosenTexts = Lists.newArrayListWithCapacity(k);
+      List<Cluster> chosenClusters = Lists.newArrayListWithCapacity(k);
       int nextClusterId = 0;
       
       for (FileStatus fileStatus : inputFiles) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDADriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDADriver.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDADriver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDADriver.java Fri Jun 10 21:58:14 2011
@@ -107,7 +107,7 @@ public final class LDADriver extends Abs
     double[] logTotals = new double[numTopics];
     Arrays.fill(logTotals, Double.NEGATIVE_INFINITY);
     double ll = 0.0;
-    if(empty) {
+    if (empty) {
       return new LDAState(numTopics, numWords, topicSmoothing, pWgT, logTotals, ll);
     }
     for (Pair<IntPairWritable,DoubleWritable> record
@@ -180,7 +180,7 @@ public final class LDADriver extends Abs
     FileSystem fs = FileSystem.get(conf);
     Path lastPath = null;
     int maxIteration = Integer.MIN_VALUE;
-    for(FileStatus fstatus : fs.globStatus(new Path(stateDir, "state-*"))) {
+    for (FileStatus fstatus : fs.globStatus(new Path(stateDir, "state-*"))) {
       try {
         int iteration = Integer.parseInt(fstatus.getPath().getName().split("-")[1]);
         if(iteration > maxIteration) {
@@ -205,7 +205,7 @@ public final class LDADriver extends Abs
     throws IOException, InterruptedException, ClassNotFoundException {
     Path lastKnownState = getLastKnownStatePath(conf, output);
     Path stateIn;
-    if(lastKnownState == null) {
+    if (lastKnownState == null) {
       stateIn = new Path(output, "state-0");
       writeInitialState(stateIn, numTopics, numWords);
     } else {
@@ -336,10 +336,10 @@ public final class LDADriver extends Abs
   }
 
   private double runIterationSequential(Configuration conf, Path input, Path stateOut) throws IOException {
-    if(state == null) {
+    if (state == null) {
       state = createState(conf);
     }
-    if(trainingCorpus == null) {
+    if (trainingCorpus == null) {
       Class<? extends Writable> keyClass = peekAtSequenceFileForKeyType(conf, input);
       Collection<Pair<Writable, VectorWritable>> corpus = new LinkedList<Pair<Writable, VectorWritable>>();
       for (FileStatus fileStatus : FileSystem.get(conf).globStatus(new Path(input, "part-*"))) {
@@ -362,7 +362,7 @@ public final class LDADriver extends Abs
     }
     LDAState newState = createState(conf, true);
     double ll = 0.0;
-    for(Pair<Writable, VectorWritable> slice : trainingCorpus) {
+    for (Pair<Writable, VectorWritable> slice : trainingCorpus) {
       LDAInference.InferredDocument doc;
       Vector wordCounts = slice.getSecond().get();
       try {
@@ -469,7 +469,7 @@ public final class LDADriver extends Abs
       Writable key = ReflectionUtils.newInstance(keyClass, conf);
       Writable vw = new VectorWritable();
 
-      for(Pair<Writable, VectorWritable> slice : trainingCorpus) {
+      for (Pair<Writable, VectorWritable> slice : trainingCorpus) {
         Vector wordCounts = slice.getSecond().get();
         try {
           inference.infer(wordCounts);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyClusterMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyClusterMapper.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyClusterMapper.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyClusterMapper.java Fri Jun 10 21:58:14 2011
@@ -18,9 +18,9 @@
 package org.apache.mahout.clustering.meanshift;
 
 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.hadoop.io.IntWritable;
@@ -59,7 +59,7 @@ public class MeanShiftCanopyClusterMappe
 
   public static List<MeanShiftCanopy> getCanopies(Configuration conf) {
     String statePath = conf.get(MeanShiftCanopyDriver.STATE_IN_KEY);
-    List<MeanShiftCanopy> canopies = new ArrayList<MeanShiftCanopy>();
+    List<MeanShiftCanopy> canopies = Lists.newArrayList();
     Path path = new Path(statePath);
     for (MeanShiftCanopy value 
          : new SequenceFileDirValueIterable<MeanShiftCanopy>(path, PathType.LIST, PathFilters.logsCRCFilter(), conf)) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyClusterer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyClusterer.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyClusterer.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyClusterer.java Fri Jun 10 21:58:14 2011
@@ -17,11 +17,11 @@
 
 package org.apache.mahout.clustering.meanshift;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.mahout.common.distance.DistanceMeasure;
 import org.apache.mahout.common.kernel.IKernelProfile;
@@ -194,7 +194,7 @@ public class MeanShiftCanopyClusterer {
         aKernelProfileDerivative, t1, t2, convergenceThreshold);
     int nextCanopyId = 0;
     
-    List<MeanShiftCanopy> canopies = new ArrayList<MeanShiftCanopy>();
+    List<MeanShiftCanopy> canopies = Lists.newArrayList();
     for (Vector point : points) {
       clusterer.mergeCanopy(
           new MeanShiftCanopy(point, nextCanopyId++, measure), canopies);
@@ -210,7 +210,7 @@ public class MeanShiftCanopyClusterer {
   protected List<MeanShiftCanopy> iterate(Iterable<MeanShiftCanopy> canopies,
       boolean[] converged) {
     converged[0] = true;
-    List<MeanShiftCanopy> migratedCanopies = new ArrayList<MeanShiftCanopy>();
+    List<MeanShiftCanopy> migratedCanopies = Lists.newArrayList();
     for (MeanShiftCanopy canopy : canopies) {
       converged[0] = shiftToMean(canopy) && converged[0];
       mergeCanopy(canopy, migratedCanopies);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyDriver.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyDriver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyDriver.java Fri Jun 10 21:58:14 2011
@@ -18,12 +18,10 @@
 package org.apache.mahout.clustering.meanshift;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.cli2.builder.ArgumentBuilder;
-import org.apache.commons.cli2.builder.DefaultOptionBuilder;
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -53,7 +51,6 @@ import org.apache.mahout.common.iterator
 import org.apache.mahout.common.iterator.sequencefile.SequenceFileIterable;
 import org.apache.mahout.common.iterator.sequencefile.SequenceFileValueIterable;
 import org.apache.mahout.common.kernel.IKernelProfile;
-import org.apache.mahout.common.kernel.TriangularKernelProfile;
 import org.apache.mahout.math.VectorWritable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -292,7 +289,7 @@ public class MeanShiftCanopyDriver exten
       double t2, double convergenceDelta, int maxIterations) throws IOException {
     MeanShiftCanopyClusterer clusterer = new MeanShiftCanopyClusterer(measure,
         aKernelProfile, t1, t2, convergenceDelta);
-    List<MeanShiftCanopy> clusters = new ArrayList<MeanShiftCanopy>();
+    List<MeanShiftCanopy> clusters = Lists.newArrayList();
     Configuration conf = new Configuration();
     FileSystem fs = FileSystem.get(clustersIn.toUri(), conf);
     for (MeanShiftCanopy value : new SequenceFileDirValueIterable<MeanShiftCanopy>(
@@ -437,7 +434,7 @@ public class MeanShiftCanopyDriver exten
    */
   private static void clusterDataSeq(Path input, Path clustersIn, Path output)
       throws IOException {
-    Collection<MeanShiftCanopy> clusters = new ArrayList<MeanShiftCanopy>();
+    Collection<MeanShiftCanopy> clusters = Lists.newArrayList();
     Configuration conf = new Configuration();
     for (MeanShiftCanopy value : new SequenceFileDirValueIterable<MeanShiftCanopy>(
         clustersIn, PathType.LIST, PathFilters.logsCRCFilter(), conf)) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyMapper.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyMapper.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyMapper.java Fri Jun 10 21:58:14 2011
@@ -18,16 +18,16 @@
 package org.apache.mahout.clustering.meanshift;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.WritableComparable;
 import org.apache.hadoop.mapreduce.Mapper;
 
 public class MeanShiftCanopyMapper extends Mapper<WritableComparable<?>,MeanShiftCanopy,Text,MeanShiftCanopy> {
   
-  private final Collection<MeanShiftCanopy> canopies = new ArrayList<MeanShiftCanopy>();
+  private final Collection<MeanShiftCanopy> canopies = Lists.newArrayList();
   
   private MeanShiftCanopyClusterer clusterer;
 

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyReducer.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyReducer.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyReducer.java Fri Jun 10 21:58:14 2011
@@ -18,9 +18,9 @@
 package org.apache.mahout.clustering.meanshift;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -29,7 +29,7 @@ import org.apache.hadoop.mapreduce.Reduc
 
 public class MeanShiftCanopyReducer extends Reducer<Text,MeanShiftCanopy,Text,MeanShiftCanopy> {
   
-  private final Collection<MeanShiftCanopy> canopies = new ArrayList<MeanShiftCanopy>();
+  private final Collection<MeanShiftCanopy> canopies = Lists.newArrayList();
   private MeanShiftCanopyClusterer clusterer;
   private boolean allConverged = true;
 

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/MinHashDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/MinHashDriver.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/MinHashDriver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/MinHashDriver.java Fri Jun 10 21:58:14 2011
@@ -59,9 +59,8 @@ public final class MinHashDriver extends
     conf.setInt(MinhashOptionCreator.KEY_GROUPS, keyGroups);
     conf.setBoolean(MinhashOptionCreator.DEBUG_OUTPUT, debugOutput);
 
-    Class<? extends Writable> outputClass = 
-        debugOutput ? VectorWritable.class : Text.class;
-    Class<? extends OutputFormat> outputFormatClass = 
+    Class<? extends Writable> outputClass = debugOutput ? VectorWritable.class : Text.class;
+    Class<? extends OutputFormat> outputFormatClass =
         debugOutput ? SequenceFileOutputFormat.class : TextOutputFormat.class;
     
     Job job = new Job(conf, "MinHash Clustering");

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/MinHashReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/MinHashReducer.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/MinHashReducer.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/MinHashReducer.java Fri Jun 10 21:58:14 2011
@@ -17,6 +17,7 @@
 
 package org.apache.mahout.clustering.minhash;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.Writable;
@@ -26,7 +27,6 @@ import org.apache.mahout.math.Vector;
 import org.apache.mahout.math.VectorWritable;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 
 public class MinHashReducer extends Reducer<Text,Writable,Text,Writable> {
@@ -53,7 +53,7 @@ public class MinHashReducer extends Redu
   @Override
   protected void reduce(Text cluster, Iterable<Writable> points, Context context)
     throws IOException, InterruptedException {
-    Collection<Writable> pointList = new ArrayList<Writable>();
+    Collection<Writable> pointList = Lists.newArrayList();
     for (Writable point : points) {
       if (debugOutput) {
         Vector pointVector = ((VectorWritable) point).get().clone();

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsDriver.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsDriver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsDriver.java Fri Jun 10 21:58:14 2011
@@ -17,6 +17,7 @@
 
 package org.apache.mahout.clustering.spectral.eigencuts;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.util.ToolRunner;
@@ -35,7 +36,6 @@ import org.apache.mahout.math.hadoop.dec
 import org.apache.mahout.math.stats.OnlineSummarizer;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -134,7 +134,7 @@ public class EigencutsDriver extends Abs
 
       DistributedRowMatrix U = performEigenDecomposition(conf, L, state, eigenrank, overshoot, outputCalc);
       U.setConf(new Configuration(conf));
-      List<Double> eigenValues = new ArrayList<Double>();
+      List<Double> eigenValues = Lists.newArrayList();
       for(int i=0; i<eigenrank; i++) {
         eigenValues.set(i, state.getSingularValue(i));
       }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityMapper.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityMapper.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityMapper.java Fri Jun 10 21:58:14 2011
@@ -18,9 +18,9 @@
 package org.apache.mahout.clustering.spectral.eigencuts;
 
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.Map;
 
+import com.google.common.collect.Maps;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.mapreduce.Mapper;
@@ -71,7 +71,7 @@ public class EigencutsSensitivityMapper 
     
     // go through the vector, performing the calculations
     // sadly, no way to get around n^2 computations      
-    Map<Integer, EigencutsSensitivityNode> columns = new HashMap<Integer, EigencutsSensitivityNode>();
+    Map<Integer, EigencutsSensitivityNode> columns = Maps.newHashMap();
     Vector ev = vw.get();
     for (int i = 0; i < ev.size(); i++) {
       double minsij = Double.MAX_VALUE;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java Fri Jun 10 21:58:14 2011
@@ -40,13 +40,7 @@ public final class IOUtils {
   private static final Logger log = LoggerFactory.getLogger(IOUtils.class);
   
   private IOUtils() { }
-  
-  public static void quietClose(Closeable... closeables) {
-    for (Closeable closeable : closeables) {
-      Closeables.closeQuietly(closeable);
-    }
-  }
-  
+
   // Sheez, why can't ResultSet, Statement and Connection implement Closeable?
   
   public static void quietClose(ResultSet closeable) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/IntegerTuple.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/IntegerTuple.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/IntegerTuple.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/IntegerTuple.java Fri Jun 10 21:58:14 2011
@@ -20,10 +20,10 @@ package org.apache.mahout.common;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.io.WritableComparable;
 
 /**
@@ -33,7 +33,7 @@ import org.apache.hadoop.io.WritableComp
  */
 public final class IntegerTuple implements WritableComparable<IntegerTuple> {
   
-  private List<Integer> tuple = new ArrayList<Integer>();
+  private List<Integer> tuple = Lists.newArrayList();
   
   public IntegerTuple() { }
   
@@ -137,7 +137,7 @@ public final class IntegerTuple implemen
   @Override
   public void readFields(DataInput in) throws IOException {
     int len = in.readInt();
-    tuple = new ArrayList<Integer>(len);
+    tuple = Lists.newArrayListWithCapacity(len);
     for (int i = 0; i < len; i++) {
       int data = in.readInt();
       tuple.add(data);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/Parameters.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/Parameters.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/Parameters.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/Parameters.java Fri Jun 10 21:58:14 2011
@@ -18,9 +18,9 @@
 package org.apache.mahout.common;
 
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.Map;
 
+import com.google.common.collect.Maps;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.DefaultStringifier;
 import org.apache.hadoop.util.GenericsUtil;
@@ -31,7 +31,7 @@ public class Parameters {
   
   private static final Logger log = LoggerFactory.getLogger(Parameters.class);
   
-  private Map<String,String> params = new HashMap<String,String>();
+  private Map<String,String> params = Maps.newHashMap();
 
   public Parameters() {
 
@@ -84,7 +84,7 @@ public class Parameters {
     conf.set("io.serializations",
              "org.apache.hadoop.io.serializer.JavaSerialization,"
              + "org.apache.hadoop.io.serializer.WritableSerialization");
-    Map<String,String> params = new HashMap<String,String>();
+    Map<String,String> params = Maps.newHashMap();
     DefaultStringifier<Map<String,String>> mapStringifier = new DefaultStringifier<Map<String,String>>(conf,
         GenericsUtil.getClass(params));
     return mapStringifier.fromString(serializedString);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/StringTuple.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/StringTuple.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/StringTuple.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/StringTuple.java Fri Jun 10 21:58:14 2011
@@ -20,10 +20,10 @@ package org.apache.mahout.common;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.WritableComparable;
 
@@ -32,7 +32,7 @@ import org.apache.hadoop.io.WritableComp
  */
 public final class StringTuple implements WritableComparable<StringTuple> {
   
-  private List<String> tuple = new ArrayList<String>();
+  private List<String> tuple = Lists.newArrayList();
   
   public StringTuple() { }
   
@@ -136,7 +136,7 @@ public final class StringTuple implement
   @Override
   public void readFields(DataInput in) throws IOException {
     int len = in.readInt();
-    tuple = new ArrayList<String>(len);
+    tuple = Lists.newArrayListWithCapacity(len);
     Text value = new Text();
     for (int i = 0; i < len; i++) {
       value.readFields(in);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/MahalanobisDistanceMeasure.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/MahalanobisDistanceMeasure.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/MahalanobisDistanceMeasure.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/MahalanobisDistanceMeasure.java Fri Jun 10 21:58:14 2011
@@ -20,10 +20,10 @@ package org.apache.mahout.common.distanc
 import java.io.DataInputStream;
 import java.io.FileNotFoundException;
 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.FileSystem;
@@ -116,14 +116,13 @@ public class MahalanobisDistanceMeasure 
   
   @Override
   public void createParameters(String prefix, Configuration jobConf) {
-    parameters = new ArrayList<Parameter<?>>();
+    parameters = Lists.newArrayList();
     inverseCovarianceFile = new PathParameter(prefix, "inverseCovarianceFile", jobConf, null,
                                               "Path on DFS to a file containing the inverse covariance matrix.");
     parameters.add(inverseCovarianceFile);
 
-    matrixClass =
-        new ClassParameter(prefix, "maxtrixClass", jobConf, DenseMatrix.class,
-                           "Class<Matix> file specified in parameter inverseCovarianceFile has been serialized with.");
+    matrixClass = new ClassParameter(prefix, "maxtrixClass", jobConf, DenseMatrix.class,
+        "Class<Matix> file specified in parameter inverseCovarianceFile has been serialized with.");
     parameters.add(matrixClass);      
     
     meanVectorFile = new PathParameter(prefix, "meanVectorFile", jobConf, null,

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/MinkowskiDistanceMeasure.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/MinkowskiDistanceMeasure.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/MinkowskiDistanceMeasure.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/MinkowskiDistanceMeasure.java Fri Jun 10 21:58:14 2011
@@ -17,11 +17,11 @@
 
 package org.apache.mahout.common.distance;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.mahout.common.parameters.DoubleParameter;
 import org.apache.mahout.common.parameters.Parameter;
@@ -51,7 +51,7 @@ public class MinkowskiDistanceMeasure im
 
   @Override
   public void createParameters(String prefix, Configuration conf) {
-    parameters = new ArrayList<Parameter<?>>();
+    parameters = Lists.newArrayList();
     Parameter<?> param =
         new DoubleParameter(prefix, "exponent", conf, EXPONENT, "Exponent for Fractional Lagrange distance");
     parameters.add(param);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/WeightedDistanceMeasure.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/WeightedDistanceMeasure.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/WeightedDistanceMeasure.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/WeightedDistanceMeasure.java Fri Jun 10 21:58:14 2011
@@ -20,10 +20,10 @@ package org.apache.mahout.common.distanc
 import java.io.DataInputStream;
 import java.io.FileNotFoundException;
 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.FileSystem;
@@ -45,7 +45,7 @@ public abstract class WeightedDistanceMe
   
   @Override
   public void createParameters(String prefix, Configuration jobConf) {
-    parameters = new ArrayList<Parameter<?>>();
+    parameters = Lists.newArrayList();
     weightsFile = new PathParameter(prefix, "weightsFile", jobConf, null,
         "Path on DFS to a file containing the weights.");
     parameters.add(weightsFile);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FixedSizeSamplingIterator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FixedSizeSamplingIterator.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FixedSizeSamplingIterator.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FixedSizeSamplingIterator.java Fri Jun 10 21:58:14 2011
@@ -17,12 +17,12 @@
 
 package org.apache.mahout.common.iterator;
 
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Random;
 
 import com.google.common.collect.ForwardingIterator;
+import com.google.common.collect.Lists;
 import org.apache.mahout.common.RandomUtils;
 
 /**
@@ -33,7 +33,7 @@ public final class FixedSizeSamplingIter
   private final Iterator<T> delegate;
   
   public FixedSizeSamplingIterator(int size, Iterator<T> source) {
-    List<T> buf = new ArrayList<T>(size);
+    List<T> buf = Lists.newArrayListWithCapacity(size);
     int sofar = 0;
     Random random = RandomUtils.getRandom();
     while (source.hasNext()) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/StableFixedSizeSamplingIterator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/StableFixedSizeSamplingIterator.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/StableFixedSizeSamplingIterator.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/StableFixedSizeSamplingIterator.java Fri Jun 10 21:58:14 2011
@@ -17,7 +17,6 @@
 
 package org.apache.mahout.common.iterator;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
@@ -26,6 +25,7 @@ import java.util.Random;
 import com.google.common.base.Function;
 import com.google.common.collect.ForwardingIterator;
 import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
 import org.apache.mahout.common.Pair;
 import org.apache.mahout.common.RandomUtils;
 
@@ -38,7 +38,7 @@ public class StableFixedSizeSamplingIter
   private final Iterator<T> delegate;
   
   public StableFixedSizeSamplingIterator(int size, Iterator<T> source) {
-    List<Pair<Integer,T>> buf = new ArrayList<Pair<Integer,T>>(size);
+    List<Pair<Integer,T>> buf = Lists.newArrayListWithCapacity(size);
     int sofar = 0;
     Random random = RandomUtils.getRandom();
     while (source.hasNext()) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/nlp/NGrams.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/nlp/NGrams.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/nlp/NGrams.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/nlp/NGrams.java Fri Jun 10 21:58:14 2011
@@ -17,8 +17,9 @@
 
 package org.apache.mahout.common.nlp;
 
-import java.util.ArrayList;
-import java.util.HashMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
@@ -35,12 +36,12 @@ public class NGrams {
   }
   
   public Map<String,List<String>> generateNGrams() {
-    Map<String,List<String>> returnDocument = new HashMap<String,List<String>>();
+    Map<String,List<String>> returnDocument = Maps.newHashMap();
     
     StringTokenizer tokenizer = new StringTokenizer(line);
-    List<String> tokens = new ArrayList<String>();
+    List<String> tokens = Lists.newArrayList();
     String labelName = tokenizer.nextToken();
-    List<String> previousN1Grams = new ArrayList<String>();
+    List<String> previousN1Grams = Lists.newArrayList();
     while (tokenizer.hasMoreTokens()) {
       
       String nextToken = tokenizer.nextToken();
@@ -66,9 +67,9 @@ public class NGrams {
   public List<String> generateNGramsWithoutLabel() {
     
     StringTokenizer tokenizer = new StringTokenizer(line);
-    List<String> tokens = new ArrayList<String>();
+    List<String> tokens = Lists.newArrayList();
     
-    List<String> previousN1Grams = new ArrayList<String>();
+    List<String> previousN1Grams = Lists.newArrayList();
     while (tokenizer.hasMoreTokens()) {
       
       String nextToken = tokenizer.nextToken();

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/DecisionForest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/DecisionForest.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/DecisionForest.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/DecisionForest.java Fri Jun 10 21:58:14 2011
@@ -17,13 +17,13 @@
 
 package org.apache.mahout.df;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.DataInput;
 
+import com.google.common.collect.Lists;
 import com.google.common.io.Closeables;
 import org.apache.mahout.df.callback.PredictionCallback;
 import org.apache.mahout.df.data.Data;
@@ -46,7 +46,7 @@ public class DecisionForest implements W
   private final List<Node> trees;
   
   protected DecisionForest() {
-    trees = new ArrayList<Node>();
+    trees = Lists.newArrayList();
   }
   
   public DecisionForest(List<Node> trees) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/data/Data.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/data/Data.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/data/Data.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/data/Data.java Fri Jun 10 21:58:14 2011
@@ -18,12 +18,12 @@
 package org.apache.mahout.df.data;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Random;
 
+import com.google.common.collect.Lists;
 import com.google.common.io.Closeables;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FileSystem;
@@ -41,10 +41,15 @@ public class Data implements Cloneable {
   private final List<Instance> instances;
   
   private final Dataset dataset;
-  
+
+  public Data(Dataset dataset) {
+    this.dataset = dataset;
+    this.instances = Lists.newArrayList();
+  }
+
   public Data(Dataset dataset, List<Instance> instances) {
     this.dataset = dataset;
-    this.instances = new ArrayList<Instance>(instances);
+    this.instances = Lists.newArrayList(instances);
   }
   
   /**
@@ -96,7 +101,7 @@ public class Data implements Cloneable {
    * @return the subset from this data that matches the given condition
    */
   public Data subset(Condition condition) {
-    List<Instance> subset = new ArrayList<Instance>();
+    List<Instance> subset = Lists.newArrayList();
     
     for (Instance instance : instances) {
       if (condition.isTrueFor(instance)) {
@@ -115,7 +120,7 @@ public class Data implements Cloneable {
    * @return a random subset without modifying the current data
    */
   public Data rsubset(Random rng, double ratio) {
-    List<Instance> subset = new ArrayList<Instance>();
+    List<Instance> subset = Lists.newArrayList();
     
     for (Instance instance : instances) {
       if (rng.nextDouble() < ratio) {
@@ -133,7 +138,7 @@ public class Data implements Cloneable {
    */
   public Data bagging(Random rng) {
     int datasize = size();
-    List<Instance> bag = new ArrayList<Instance>(datasize);
+    List<Instance> bag = Lists.newArrayListWithCapacity(datasize);
     
     for (int i = 0; i < datasize; i++) {
       bag.add(instances.get(rng.nextInt(datasize)));
@@ -153,7 +158,7 @@ public class Data implements Cloneable {
    */
   public Data bagging(Random rng, boolean[] sampled) {
     int datasize = size();
-    List<Instance> bag = new ArrayList<Instance>(datasize);
+    List<Instance> bag = Lists.newArrayListWithCapacity(datasize);
     
     for (int i = 0; i < datasize; i++) {
       int index = rng.nextInt(datasize);
@@ -170,7 +175,7 @@ public class Data implements Cloneable {
    * @param rng
    */
   public Data rsplit(Random rng, int subsize) {
-    List<Instance> subset = new ArrayList<Instance>(subsize);
+    List<Instance> subset = Lists.newArrayListWithCapacity(subsize);
     
     for (int i = 0; i < subsize; i++) {
       subset.add(instances.remove(rng.nextInt(instances.size())));
@@ -244,7 +249,7 @@ public class Data implements Cloneable {
   
   @Override
   public Data clone() {
-    return new Data(dataset, new ArrayList<Instance>(instances));
+    return new Data(dataset, Lists.newArrayList(instances));
   }
   
   @Override

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DataLoader.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DataLoader.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DataLoader.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DataLoader.java Fri Jun 10 21:58:14 2011
@@ -18,12 +18,12 @@
 package org.apache.mahout.df.data;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Scanner;
 import java.util.StringTokenizer;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -98,7 +98,7 @@ public final class DataLoader {
       } else { // CATEGORICAL or LABEL
         // update values
         if (values[attr] == null) {
-          values[attr] = new ArrayList<String>();
+          values[attr] = Lists.newArrayList();
         }
         if (!values[attr].contains(token)) {
           values[attr].add(token);
@@ -134,7 +134,7 @@ public final class DataLoader {
     FSDataInputStream input = fs.open(fpath);
     Scanner scanner = new Scanner(input);
     
-    List<Instance> instances = new ArrayList<Instance>();
+    List<Instance> instances = Lists.newArrayList();
     
     DataConverter converter = new DataConverter(dataset);
     
@@ -164,7 +164,7 @@ public final class DataLoader {
    * Loads the data from a String array
    */
   public static Data loadData(Dataset dataset, String[] data) {
-    List<Instance> instances = new ArrayList<Instance>();
+    List<Instance> instances = Lists.newArrayList();
     
     DataConverter converter = new DataConverter(dataset);
     

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DataUtils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DataUtils.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DataUtils.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DataUtils.java Fri Jun 10 21:58:14 2011
@@ -18,8 +18,8 @@
 package org.apache.mahout.df.data;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
@@ -72,7 +72,7 @@ public final class DataUtils {
    */
   public static int maxindex(Random rng, int[] values) {
     int max = 0;
-    List<Integer> maxindices = new ArrayList<Integer>();
+    List<Integer> maxindices = Lists.newArrayList();
     
     for (int index = 0; index < values.length; index++) {
       if (values[index] > max) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DescriptorUtils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DescriptorUtils.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DescriptorUtils.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/data/DescriptorUtils.java Fri Jun 10 21:58:14 2011
@@ -17,11 +17,11 @@
 
 package org.apache.mahout.df.data;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Locale;
 import java.util.StringTokenizer;
 
+import com.google.common.collect.Lists;
 import org.apache.mahout.df.data.Dataset.Attribute;
 
 /**
@@ -65,7 +65,7 @@ public final class DescriptorUtils {
    */
   public static String generateDescriptor(String description) throws DescriptorException {
     StringTokenizer tokenizer = new StringTokenizer(description, " ");
-    Collection<String> tokens = new ArrayList<String>();
+    Collection<String> tokens = Lists.newArrayList();
     
     while (tokenizer.hasMoreTokens()) {
       tokens.add(tokenizer.nextToken());

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/inmem/InMemBuilder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/inmem/InMemBuilder.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/inmem/InMemBuilder.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/inmem/InMemBuilder.java Fri Jun 10 21:58:14 2011
@@ -18,11 +18,11 @@
 package org.apache.mahout.df.mapreduce.inmem;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.filecache.DistributedCache;
 import org.apache.hadoop.fs.FileSystem;
@@ -81,7 +81,7 @@ public class InMemBuilder extends Builde
   protected DecisionForest parseOutput(Job job, PredictionCallback callback) throws IOException {
     Configuration conf = job.getConfiguration();
     
-    Map<Integer,MapredOutput> output = new HashMap<Integer,MapredOutput>();
+    Map<Integer,MapredOutput> output = Maps.newHashMap();
     
     Path outputPath = getOutputPath(conf);
     FileSystem fs = outputPath.getFileSystem(conf);
@@ -102,7 +102,7 @@ public class InMemBuilder extends Builde
    * Process the output, extracting the trees and passing the predictions to the callback
    */
   private static DecisionForest processOutput(Map<Integer,MapredOutput> output, PredictionCallback callback) {
-    List<Node> trees = new ArrayList<Node>();
+    List<Node> trees = Lists.newArrayList();
     
     for (Map.Entry<Integer,MapredOutput> entry : output.entrySet()) {
       MapredOutput value = entry.getValue();

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/inmem/InMemInputFormat.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/inmem/InMemInputFormat.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/inmem/InMemInputFormat.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/inmem/InMemInputFormat.java Fri Jun 10 21:58:14 2011
@@ -20,11 +20,11 @@ package org.apache.mahout.df.mapreduce.i
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Random;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.NullWritable;
@@ -93,7 +93,7 @@ public class InMemInputFormat extends In
     
     int id = 0;
     
-    List<InputSplit> splits = new ArrayList<InputSplit>(numSplits);
+    List<InputSplit> splits = Lists.newArrayListWithCapacity(numSplits);
     
     for (int index = 0; index < numSplits - 1; index++) {
       splits.add(new InMemInputSplit(id, splitSize, nextSeed()));

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java Fri Jun 10 21:58:14 2011
@@ -21,10 +21,10 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.net.URI;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.filecache.DistributedCache;
@@ -130,8 +130,8 @@ public class Step0Job {
     
     log.info("mapred.map.tasks = {}", conf.getInt("mapred.map.tasks", -1));
 
-    List<Integer> keys = new ArrayList<Integer>();
-    List<Step0Output> values = new ArrayList<Step0Output>();
+    List<Integer> keys = Lists.newArrayList();
+    List<Step0Output> values = Lists.newArrayList();
 
     // read all the outputs
     for (Pair<IntWritable,Step0Output> record

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step1Mapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step1Mapper.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step1Mapper.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step1Mapper.java Fri Jun 10 21:58:14 2011
@@ -18,10 +18,10 @@
 package org.apache.mahout.df.mapreduce.partial;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
@@ -63,7 +63,7 @@ public class Step1Mapper extends MapredM
   private int partition;
   
   /** will contain all instances if this mapper's split */
-  private final List<Instance> instances = new ArrayList<Instance>();
+  private final List<Instance> instances = Lists.newArrayList();
   
   public int getFirstTreeId() {
     return firstTreeId;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/ref/SequentialBuilder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/ref/SequentialBuilder.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/ref/SequentialBuilder.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/ref/SequentialBuilder.java Fri Jun 10 21:58:14 2011
@@ -17,10 +17,10 @@
 
 package org.apache.mahout.df.ref;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
+import com.google.common.collect.Lists;
 import org.apache.mahout.df.Bagging;
 import org.apache.mahout.df.DecisionForest;
 import org.apache.mahout.df.builder.TreeBuilder;
@@ -57,7 +57,7 @@ public class SequentialBuilder {
   }
   
   public DecisionForest build(int nbTrees, PredictionCallback callback) {
-    List<Node> trees = new ArrayList<Node>();
+    List<Node> trees = Lists.newArrayList();
     
     for (int treeId = 0; treeId < nbTrees; treeId++) {
       trees.add(bagging.build(treeId, rng, callback));

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/tools/Describe.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/tools/Describe.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/tools/Describe.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/tools/Describe.java Fri Jun 10 21:58:14 2011
@@ -18,10 +18,10 @@
 package org.apache.mahout.df.tools;
 
 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.commons.cli2.CommandLine;
 import org.apache.commons.cli2.Group;
 import org.apache.commons.cli2.Option;
@@ -131,7 +131,7 @@ public final class Describe {
   }
   
   private static List<String> convert(Collection<?> values) {
-    List<String> list = new ArrayList<String>(values.size());
+    List<String> list = Lists.newArrayListWithCapacity(values.size());
     for (Object value : values) {
       list.add(value.toString());
     }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java Fri Jun 10 21:58:14 2011
@@ -19,13 +19,13 @@ package org.apache.mahout.driver;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.google.common.io.Closeables;
 import org.apache.hadoop.util.ProgramDriver;
 import org.slf4j.Logger;
@@ -128,10 +128,10 @@ public final class MahoutDriver {
       mainProps = new Properties();
     }
 
-    Map<String,String[]> argMap = new HashMap<String,String[]>();
+    Map<String,String[]> argMap = Maps.newHashMap();
     int i = 0;
     while (i < args.length && args[i] != null) {
-      List<String> argValues = new ArrayList<String>();
+      List<String> argValues = Lists.newArrayList();
       String arg = args[i];
       i++;
       if (arg.startsWith("-D")) { // '-Dkey=value' or '-Dkey=value1,value2,etc' case
@@ -163,7 +163,7 @@ public final class MahoutDriver {
     }
 
     // Now add command-line args
-    List<String> argsList = new ArrayList<String>();
+    List<String> argsList = Lists.newArrayList();
     argsList.add(progName);
     for (Map.Entry<String,String[]> entry : argMap.entrySet()) {
       String arg = entry.getKey();

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/AggregatorMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/AggregatorMapper.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/AggregatorMapper.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/AggregatorMapper.java Fri Jun 10 21:58:14 2011
@@ -18,9 +18,9 @@
 package org.apache.mahout.fpm.pfpgrowth;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapreduce.Mapper;
 import org.apache.mahout.common.Pair;
@@ -39,7 +39,7 @@ public class AggregatorMapper extends Ma
                                                                           InterruptedException {
     for (Pair<List<String>,Long> pattern : values.getPatterns()) {
       for (String item : pattern.getFirst()) {
-        List<Pair<List<String>,Long>> patternSingularList = new ArrayList<Pair<List<String>,Long>>();
+        List<Pair<List<String>,Long>> patternSingularList = Lists.newArrayList();
         patternSingularList.add(pattern);
         context.setStatus("Aggregator Mapper:Grouping Patterns for " + item);
         context.write(new Text(item), new TopKStringPatterns(patternSingularList));

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowth.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowth.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowth.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/PFPGrowth.java Fri Jun 10 21:58:14 2011
@@ -18,13 +18,13 @@
 package org.apache.mahout.fpm.pfpgrowth;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.PriorityQueue;
 import java.util.regex.Pattern;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -88,7 +88,7 @@ public final class PFPGrowth {
   public static List<Pair<String,Long>> deserializeList(Parameters params,
                                                         String key,
                                                         Configuration conf) throws IOException {
-    List<Pair<String,Long>> list = new ArrayList<Pair<String,Long>>();
+    List<Pair<String,Long>> list = Lists.newArrayList();
     conf.set("io.serializations", "org.apache.hadoop.io.serializer.JavaSerialization,"
                                   + "org.apache.hadoop.io.serializer.WritableSerialization");
     
@@ -106,7 +106,7 @@ public final class PFPGrowth {
    * @return Deserialized Group List
    */
   public static Map<String,Long> deserializeMap(Parameters params, String key, Configuration conf) throws IOException {
-    Map<String,Long> map = new HashMap<String,Long>();
+    Map<String,Long> map = Maps.newHashMap();
     conf.set("io.serializations", "org.apache.hadoop.io.serializer.JavaSerialization,"
                                   + "org.apache.hadoop.io.serializer.WritableSerialization");
     
@@ -138,7 +138,7 @@ public final class PFPGrowth {
         queue.add(new Pair<String,Long>(record.getFirst().toString(), value));
       }
     }
-    List<Pair<String,Long>> fList = new ArrayList<Pair<String,Long>>();
+    List<Pair<String,Long>> fList = Lists.newArrayList();
     while (!queue.isEmpty()) {
       fList.add(queue.poll());
     }
@@ -158,7 +158,7 @@ public final class PFPGrowth {
     FileSystem fs = FileSystem.get(frequentPatternsPath.toUri(), conf);
     FileStatus[] outputFiles = fs.globStatus(new Path(frequentPatternsPath, FILE_PATTERN));
     
-    List<Pair<String,TopKStringPatterns>> ret = new ArrayList<Pair<String,TopKStringPatterns>>();
+    List<Pair<String,TopKStringPatterns>> ret = Lists.newArrayList();
     for (FileStatus fileStatus : outputFiles) {
       ret.addAll(FPGrowth.readFrequentPattern(conf, fileStatus.getPath()));
     }
@@ -226,7 +226,7 @@ public final class PFPGrowth {
     List<Pair<String,Long>> fList = readFList(params);
     Integer numGroups = Integer.valueOf(params.get(NUM_GROUPS, "50"));
     
-    Map<String,Long> gList = new HashMap<String,Long>();
+    Map<String,Long> gList = Maps.newHashMap();
     long maxPerGroup = fList.size() / numGroups;
     if (fList.size() != maxPerGroup * numGroups) {
       maxPerGroup++;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/ParallelFPGrowthReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/ParallelFPGrowthReducer.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/ParallelFPGrowthReducer.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/ParallelFPGrowthReducer.java Fri Jun 10 21:58:14 2011
@@ -18,13 +18,13 @@
 package org.apache.mahout.fpm.pfpgrowth;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import com.google.common.collect.Lists;
 import org.apache.commons.lang.mutable.MutableLong;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
@@ -47,7 +47,7 @@ import org.apache.mahout.math.map.OpenOb
  */
 public class ParallelFPGrowthReducer extends Reducer<LongWritable,TransactionTree,Text,TopKStringPatterns> {
   
-  private final List<String> featureReverseMap = new ArrayList<String>();
+  private final List<String> featureReverseMap = Lists.newArrayList();
   
   private final OpenObjectIntHashMap<String> fMap = new OpenObjectIntHashMap<String>();
   
@@ -66,7 +66,7 @@ public class ParallelFPGrowthReducer ext
       }
     }
     
-    List<Pair<Integer,Long>> localFList = new ArrayList<Pair<Integer,Long>>();
+    List<Pair<Integer,Long>> localFList = Lists.newArrayList();
     for (Entry<Integer,MutableLong> fItem : cTree.generateFList().entrySet()) {
       localFList.add(new Pair<Integer,Long>(fItem.getKey(), fItem.getValue().toLong()));
       

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionSortingMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionSortingMapper.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionSortingMapper.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionSortingMapper.java Fri Jun 10 21:58:14 2011
@@ -18,13 +18,13 @@
 package org.apache.mahout.fpm.pfpgrowth;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 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;
@@ -50,7 +50,7 @@ public class TransactionSortingMapper ex
     String[] items = splitter.split(input.toString());
     Iterable<String> uniqueItems = new HashSet<String>(Arrays.asList(items));
     
-    List<Integer> itemSet = new ArrayList<Integer>();
+    List<Integer> itemSet = Lists.newArrayList();
     for (String item : uniqueItems) { // remove items not in the fList
       if (fMap.containsKey(item) && item.trim().length() != 0) {
         itemSet.add(fMap.get(item));

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java Fri Jun 10 21:58:14 2011
@@ -20,15 +20,15 @@ package org.apache.mahout.fpm.pfpgrowth;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import org.apache.commons.lang.mutable.MutableLong;
 import org.apache.hadoop.io.VIntWritable;
 import org.apache.hadoop.io.VLongWritable;
@@ -78,7 +78,7 @@ public final class TransactionTree imple
   
   public TransactionTree(Integer[] items, Long support) {
     representedAsList = true;
-    transactionSet = new ArrayList<Pair<List<Integer>,Long>>();
+    transactionSet = Lists.newArrayList();
     transactionSet.add(new Pair<List<Integer>,Long>(Arrays.asList(items), support));
   }
   
@@ -168,7 +168,7 @@ public final class TransactionTree imple
   }
   
   public Map<Integer,MutableLong> generateFList() {
-    Map<Integer,MutableLong> frequencyList = new HashMap<Integer,MutableLong>();
+    Map<Integer,MutableLong> frequencyList = Maps.newHashMap();
     Iterator<Pair<List<Integer>,Long>> it = iterator();
     //int items = 0;
     //int count = 0;
@@ -198,7 +198,7 @@ public final class TransactionTree imple
       }
     };
     int size = 0;
-    List<Pair<List<Integer>,Long>> compressedTransactionSet = new ArrayList<Pair<List<Integer>,Long>>();
+    List<Pair<List<Integer>,Long>> compressedTransactionSet = Lists.newArrayList();
     while (it.hasNext()) {
       Pair<List<Integer>,Long> p = it.next();
       Collections.sort(p.getFirst(), comparator);
@@ -244,7 +244,7 @@ public final class TransactionTree imple
     VLongWritable vLong = new VLongWritable();
     
     if (representedAsList) {
-      transactionSet = new ArrayList<Pair<List<Integer>,Long>>();
+      transactionSet = Lists.newArrayList();
       vInt.readFields(in);
       int numTransactions = vInt.get();
       for (int i = 0; i < numTransactions; i++) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTreeIterator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTreeIterator.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTreeIterator.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTreeIterator.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.Iterator;
 import java.util.List;
 import java.util.Stack;
 
 import com.google.common.collect.AbstractIterator;
+import com.google.common.collect.Lists;
 import org.apache.mahout.common.Pair;
 
 /**
@@ -67,7 +67,7 @@ final class TransactionTreeIterator exte
       }
     } while (sum == transactionTree.count(childId));
 
-    List<Integer> data = new ArrayList<Integer>();
+    List<Integer> data = Lists.newArrayList();
     Iterator<int[]> it = depth.iterator();
     it.next();
     while (it.hasNext()) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TopKPatternsOutputConverter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TopKPatternsOutputConverter.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TopKPatternsOutputConverter.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TopKPatternsOutputConverter.java Fri Jun 10 21:58:14 2011
@@ -18,12 +18,12 @@
 package org.apache.mahout.fpm.pfpgrowth.convertors;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.PriorityQueue;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.mahout.common.Pair;
 import org.apache.mahout.fpm.pfpgrowth.fpgrowth.FrequentPatternMaxHeap;
@@ -50,11 +50,11 @@ public final class TopKPatternsOutputCon
   
   @Override
   public void collect(Integer key, FrequentPatternMaxHeap value) throws IOException {
-    List<Pair<List<A>,Long>> perAttributePatterns = new ArrayList<Pair<List<A>,Long>>();
+    List<Pair<List<A>,Long>> perAttributePatterns = Lists.newArrayList();
     PriorityQueue<Pattern> t = value.getHeap();
     while (!t.isEmpty()) {
       Pattern itemSet = t.poll();
-      List<A> frequentPattern = new ArrayList<A>();
+      List<A> frequentPattern = Lists.newArrayList();
       for (int j = 0; j < itemSet.length(); j++) {
         frequentPattern.add(reverseMapping.get(itemSet.getPattern()[j]));
       }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerStringOutputConverter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerStringOutputConverter.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerStringOutputConverter.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerStringOutputConverter.java Fri Jun 10 21:58:14 2011
@@ -18,9 +18,9 @@
 package org.apache.mahout.fpm.pfpgrowth.convertors.integer;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.mahout.common.Pair;
@@ -46,9 +46,9 @@ public final class IntegerStringOutputCo
   @Override
   public void collect(Integer key, List<Pair<List<Integer>,Long>> value) throws IOException {
     String stringKey = featureReverseMap.get(key);
-    List<Pair<List<String>,Long>> stringValues = new ArrayList<Pair<List<String>,Long>>();
+    List<Pair<List<String>,Long>> stringValues = Lists.newArrayList();
     for (Pair<List<Integer>,Long> e : value) {
-      List<String> pattern = new ArrayList<String>();
+      List<String> pattern = Lists.newArrayList();
       for (Integer i : e.getFirst()) {
         pattern.add(featureReverseMap.get(i));
       }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/string/TopKStringPatterns.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/string/TopKStringPatterns.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/string/TopKStringPatterns.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/string/TopKStringPatterns.java Fri Jun 10 21:58:14 2011
@@ -20,11 +20,11 @@ package org.apache.mahout.fpm.pfpgrowth.
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.io.Writable;
 import org.apache.mahout.common.Pair;
 
@@ -36,11 +36,11 @@ public final class TopKStringPatterns im
   private final List<Pair<List<String>,Long>> frequentPatterns;
   
   public TopKStringPatterns() {
-    frequentPatterns = new ArrayList<Pair<List<String>,Long>>();
+    frequentPatterns = Lists.newArrayList();
   }
   
   public TopKStringPatterns(Collection<Pair<List<String>, Long>> patterns) {
-    frequentPatterns = new ArrayList<Pair<List<String>,Long>>();
+    frequentPatterns = Lists.newArrayList();
     frequentPatterns.addAll(patterns);
   }
   
@@ -53,7 +53,7 @@ public final class TopKStringPatterns im
   }
   
   public TopKStringPatterns merge(TopKStringPatterns pattern, int heapSize) {
-    List<Pair<List<String>,Long>> patterns = new ArrayList<Pair<List<String>,Long>>();
+    List<Pair<List<String>,Long>> patterns = Lists.newArrayList();
     Iterator<Pair<List<String>,Long>> myIterator = frequentPatterns.iterator();
     Iterator<Pair<List<String>,Long>> otherIterator = pattern.iterator();
     Pair<List<String>,Long> myItem = null;
@@ -107,7 +107,7 @@ public final class TopKStringPatterns im
     frequentPatterns.clear();
     int length = in.readInt();
     for (int i = 0; i < length; i++) {
-      List<String> items = new ArrayList<String>();
+      List<String> items = Lists.newArrayList();
       int itemsetLength = in.readInt();
       long support = in.readLong();
       for (int j = 0; j < itemsetLength; j++) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java Fri Jun 10 21:58:14 2011
@@ -18,17 +18,17 @@
 package org.apache.mahout.fpm.pfpgrowth.fpgrowth;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import org.apache.commons.lang.mutable.MutableLong;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
@@ -55,7 +55,7 @@ public class FPGrowth<A extends Comparab
   private static final Logger log = LoggerFactory.getLogger(FPGrowth.class);
 
   public static List<Pair<String,TopKStringPatterns>> readFrequentPattern(Configuration conf, Path path) {
-    List<Pair<String,TopKStringPatterns>> ret = new ArrayList<Pair<String,TopKStringPatterns>>();
+    List<Pair<String,TopKStringPatterns>> ret = Lists.newArrayList();
     // key is feature value is count
     for (Pair<Writable,TopKStringPatterns> record
          : new SequenceFileIterable<Writable,TopKStringPatterns>(path, true, conf)) {
@@ -77,7 +77,7 @@ public class FPGrowth<A extends Comparab
    */
   public final List<Pair<A,Long>> generateFList(Iterator<Pair<List<A>,Long>> transactions, int minSupport) {
 
-    Map<A,MutableLong> attributeSupport = new HashMap<A,MutableLong>();
+    Map<A,MutableLong> attributeSupport = Maps.newHashMap();
     while (transactions.hasNext()) {
       Pair<List<A>,Long> transaction = transactions.next();
       for (A attribute : transaction.getFirst()) {
@@ -88,7 +88,7 @@ public class FPGrowth<A extends Comparab
         }
       }
     }
-    List<Pair<A,Long>> fList = new ArrayList<Pair<A,Long>>();
+    List<Pair<A,Long>> fList = Lists.newArrayList();
     for (Entry<A,MutableLong> e : attributeSupport.entrySet()) {
       long value = e.getValue().longValue();
       if (value >= minSupport) {
@@ -130,8 +130,8 @@ public class FPGrowth<A extends Comparab
                                                  OutputCollector<A,List<Pair<List<A>,Long>>> output,
                                                  StatusUpdater updater) throws IOException {
 
-    Map<Integer,A> reverseMapping = new HashMap<Integer,A>();
-    Map<A,Integer> attributeIdMapping = new HashMap<A,Integer>();
+    Map<Integer,A> reverseMapping = Maps.newHashMap();
+    Map<A,Integer> attributeIdMapping = Maps.newHashMap();
 
     int id = 0;
     for (Pair<A,Long> feature : frequencyList) {
@@ -201,7 +201,7 @@ public class FPGrowth<A extends Comparab
                                                        TopKPatternsOutputConverter<A> outputCollector,
                                                        StatusUpdater updater) throws IOException {
 
-    Map<Integer,FrequentPatternMaxHeap> patterns = new HashMap<Integer,FrequentPatternMaxHeap>();
+    Map<Integer,FrequentPatternMaxHeap> patterns = Maps.newHashMap();
     FPTreeDepthCache treeCache = new FPTreeDepthCache();
     for (int i = tree.getHeaderTableCount() - 1; i >= 0; i--) {
       int attribute = tree.getAttributeAtIndex(i);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPTreeDepthCache.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPTreeDepthCache.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPTreeDepthCache.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPTreeDepthCache.java Fri Jun 10 21:58:14 2011
@@ -17,7 +17,8 @@
 
 package org.apache.mahout.fpm.pfpgrowth.fpgrowth;
 
-import java.util.ArrayList;
+import com.google.common.collect.Lists;
+
 import java.util.List;
 
 /**
@@ -29,7 +30,7 @@ public class FPTreeDepthCache {
   private final LeastKCache<Integer,FPTree> firstLevelCache = new LeastKCache<Integer,FPTree>(5);
   private int hits;
   private int misses;
-  private final List<FPTree> treeCache = new ArrayList<FPTree>();
+  private final List<FPTree> treeCache = Lists.newArrayList();
   
   public final FPTree getFirstLevelTree(Integer attr) {
     FPTree tree = firstLevelCache.get(attr);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/LeastKCache.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/LeastKCache.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/LeastKCache.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/LeastKCache.java Fri Jun 10 21:58:14 2011
@@ -17,8 +17,9 @@
 
 package org.apache.mahout.fpm.pfpgrowth.fpgrowth;
 
+import com.google.common.collect.Maps;
+
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.PriorityQueue;
 
@@ -30,7 +31,7 @@ public class LeastKCache<K extends Compa
   
   public LeastKCache(int capacity) {
     this.capacity = capacity;
-    cache = new HashMap<K,V>(capacity);
+    cache = Maps.newHashMapWithExpectedSize(capacity);
     queue = new PriorityQueue<K>(capacity + 1, Collections.reverseOrder());
   }
 

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/OutputUtils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/OutputUtils.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/OutputUtils.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/OutputUtils.java Fri Jun 10 21:58:14 2011
@@ -18,9 +18,9 @@
 package org.apache.mahout.ga.watchmaker;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -46,7 +46,7 @@ public final class OutputUtils {
    */
   public static Path[] listOutputFiles(FileSystem fs, Path outpath) throws IOException {
     FileStatus[] status = fs.listStatus(outpath);
-    Collection<Path> outpaths = new ArrayList<Path>();
+    Collection<Path> outpaths = Lists.newArrayList();
     for (FileStatus s : status) {
       if (!s.isDir()) {
         outpaths.add(s.getPath());

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STEvolutionEngine.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STEvolutionEngine.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STEvolutionEngine.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STEvolutionEngine.java Fri Jun 10 21:58:14 2011
@@ -17,11 +17,11 @@
 
 package org.apache.mahout.ga.watchmaker;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Random;
 
+import com.google.common.collect.Lists;
 import org.uncommons.watchmaker.framework.AbstractEvolutionEngine;
 import org.uncommons.watchmaker.framework.CandidateFactory;
 import org.uncommons.watchmaker.framework.EvaluatedCandidate;
@@ -42,12 +42,12 @@ public class STEvolutionEngine<T> extend
   
   @Override
   protected List<EvaluatedCandidate<T>> evaluatePopulation(List<T> population) {
-    List<Double> evaluations = new ArrayList<Double>();
+    List<Double> evaluations = Lists.newArrayList();
     STFitnessEvaluator<? super T> evaluator = (STFitnessEvaluator<? super T>) getFitnessEvaluator();
     
     evaluator.evaluate(population, evaluations);
     
-    List<EvaluatedCandidate<T>> evaluatedPopulation = new ArrayList<EvaluatedCandidate<T>>();
+    List<EvaluatedCandidate<T>> evaluatedPopulation = Lists.newArrayList();
     for (int index = 0; index < population.size(); index++) {
       evaluatedPopulation.add(new EvaluatedCandidate<T>(population.get(index), evaluations.get(index)));
     }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluator.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluator.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluator.java Fri Jun 10 21:58:14 2011
@@ -17,9 +17,9 @@
 
 package org.apache.mahout.ga.watchmaker;
 
-import java.util.ArrayList;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.uncommons.watchmaker.framework.FitnessEvaluator;
 
 import com.google.common.base.Preconditions;
@@ -27,7 +27,7 @@ import com.google.common.base.Preconditi
 /** Special Fitness Evaluator that evaluates all the population ones. */
 public abstract class STFitnessEvaluator<T> implements FitnessEvaluator<T> {
   
-  private final List<Double> evaluations = new ArrayList<Double>();
+  private final List<Double> evaluations = Lists.newArrayList();
   
   private List<? extends T> population;
   

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java Fri Jun 10 21:58:14 2011
@@ -17,6 +17,8 @@
 
 package org.apache.mahout.math.hadoop.decomposer;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.google.common.io.Closeables;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
@@ -41,11 +43,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -221,7 +221,7 @@ public class EigenVerificationJob extend
   }
 
   private List<Map.Entry<MatrixSlice, EigenStatus>> pruneEigens(Map<MatrixSlice, EigenStatus> eigenMetaData) {
-    List<Map.Entry<MatrixSlice, EigenStatus>> prunedEigenMeta = new ArrayList<Map.Entry<MatrixSlice, EigenStatus>>();
+    List<Map.Entry<MatrixSlice, EigenStatus>> prunedEigenMeta = Lists.newArrayList();
 
     for (Map.Entry<MatrixSlice, EigenStatus> entry : eigenMetaData.entrySet()) {
       if (Math.abs(1 - entry.getValue().getCosAngle()) < maxError && entry.getValue().getEigenValue() > minEigenValue) {
@@ -246,7 +246,7 @@ public class EigenVerificationJob extend
   }
 
   private Map<MatrixSlice, EigenStatus> verifyEigens() {
-    Map<MatrixSlice, EigenStatus> eigenMetaData = new HashMap<MatrixSlice, EigenStatus>();
+    Map<MatrixSlice, EigenStatus> eigenMetaData = Maps.newHashMap();
 
     for (MatrixSlice slice : eigensToVerify) {
       EigenStatus status = eigenVerifier.verify(corpus, slice.vector());
@@ -259,7 +259,7 @@ public class EigenVerificationJob extend
     DistributedRowMatrix eigens = new DistributedRowMatrix(eigenInput, tmpOut, 1, 1);
     eigens.setConf(conf);
     if (inMemory) {
-      List<Vector> eigenVectors = new ArrayList<Vector>();
+      List<Vector> eigenVectors = Lists.newArrayList();
       for (MatrixSlice slice : eigens) {
         eigenVectors.add(slice.vector());
       }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/RowSimilarityJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/RowSimilarityJob.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/RowSimilarityJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/RowSimilarityJob.java Fri Jun 10 21:58:14 2011
@@ -18,13 +18,13 @@
 package org.apache.mahout.math.hadoop.similarity;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IntWritable;
@@ -229,7 +229,7 @@ public class RowSimilarityJob extends Ab
     protected void reduce(VarIntWritable column, Iterable<WeightedOccurrence> weightedOccurrences, Context ctx)
       throws IOException, InterruptedException {
 
-      List<WeightedOccurrence> collectedWeightedOccurrences = new ArrayList<WeightedOccurrence>();
+      List<WeightedOccurrence> collectedWeightedOccurrences = Lists.newArrayList();
       for (WeightedOccurrence weightedOccurrence : weightedOccurrences) {
         collectedWeightedOccurrences.add(weightedOccurrence.clone());
       }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/stochasticsvd/BtJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/stochasticsvd/BtJob.java?rev=1134456&r1=1134455&r2=1134456&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/stochasticsvd/BtJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/stochasticsvd/BtJob.java Fri Jun 10 21:58:14 2011
@@ -18,11 +18,11 @@
 package org.apache.mahout.math.hadoop.stochasticsvd;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
 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;
@@ -69,7 +69,7 @@ public final class BtJob {
   public static class BtMapper extends Mapper<Writable, VectorWritable, IntWritable, VectorWritable> {
 
     private SequenceFile.Reader qInput;
-    private final List<UpperTriangular> mRs = new ArrayList<UpperTriangular>();
+    private final List<UpperTriangular> mRs = Lists.newArrayList();
     private int blockNum;
     private double[][] mQt;
     private int cnt;



Mime
View raw message