java.util.ArrayListcom.google.common.collect.Lists



Project SonarSource/sonarqube in file ...n.java.org.sonar.api.batch.DefaultFormulaData.java (2010-09-26)
@@ -19,12 +19,12 @@
  */
 package org.sonar.api.batch;
 
+import com.google.common.collect.Lists;
 import org.sonar.api.measures.FormulaData;
 import org.sonar.api.measures.Measure;
 import org.sonar.api.measures.MeasuresFilter;
 import org.sonar.api.measures.Metric;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
@@ -56,7 +56,7 @@ public class DefaultFormulaData implements FormulaData {
   }
 
   public Collection<FormulaData> getChildren() {
-    List<FormulaData> result = new ArrayList<FormulaData>();
+    List<FormulaData> result = Lists.newArrayList();
     for (DecoratorContext childContext : decoratorContext.getChildren()) {
       result.add(new DefaultFormulaData(childContext));
     }
Project apache/mahout in file ...hout.cf.taste.hadoop.RecommendedItemsWritable.java (2011-06-10)
@@ -20,9 +20,9 @@ package org.apache.mahout.cf.taste.hadoop;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
+import com.google.common.collect.Lists;
 import org.apache.hadoop.io.Writable;
 import org.apache.mahout.cf.taste.impl.recommender.GenericRecommendedItem;
 import org.apache.mahout.cf.taste.recommender.RecommendedItem;
@@ -66,7 +66,7 @@ public final class RecommendedItemsWritable implements Writable {
   @Override
   public void readFields(DataInput in) throws IOException {
     int size = in.readInt();
-    recommended = new ArrayList<RecommendedItem>(size);
+    recommended = Lists.newArrayListWithCapacity(size);
     for (int i = 0; i < size; i++) {
       long itemID = Varint.readSignedVarLong(in);
       float value = in.readFloat();
Project apache/mahout in file ...e.hadoop.slopeone.SlopeOnePrefsToDiffsReducer.java (2011-06-10)
@@ -18,10 +18,10 @@
 package org.apache.mahout.cf.taste.hadoop.slopeone;
 
 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.FloatWritable;
 import org.apache.hadoop.mapreduce.Reducer;
 import org.apache.mahout.cf.taste.hadoop.EntityEntityWritable;
@@ -35,7 +35,7 @@ public final class SlopeOnePrefsToDiffsReducer extends
   protected void reduce(VarLongWritable key,
                         Iterable<EntityPrefWritable> values,
                         Context context) throws IOException, InterruptedException {
-    List<EntityPrefWritable> prefs = new ArrayList<EntityPrefWritable>();
+    List<EntityPrefWritable> prefs = Lists.newArrayList();
     for (EntityPrefWritable writable : values) {
       prefs.add(new EntityPrefWritable(writable));
     }
Project apache/mahout in file ...che.mahout.cf.taste.impl.common.RefreshHelper.java (2011-06-10)
@@ -17,13 +17,13 @@
 
 package org.apache.mahout.cf.taste.impl.common;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.concurrent.Callable;
 import java.util.concurrent.locks.ReentrantLock;
 
+import com.google.common.collect.Lists;
 import org.apache.mahout.cf.taste.common.Refreshable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,7 +47,7 @@ public final class RefreshHelper implements Refreshable {
    *          encapsulates the containing object's own refresh logic
    */
   public RefreshHelper(Callable<?> refreshRunnable) {
-    this.dependencies = new ArrayList<Refreshable>(3);
+    this.dependencies = Lists.newArrayListWithCapacity(3);
     this.refreshLock = new ReentrantLock();
     this.refreshRunnable = refreshRunnable;
   }
Project apache/mahout in file ....impl.eval.GenericRecommenderIRStatsEvaluator.java (2011-06-10)
@@ -17,11 +17,11 @@
 
 package org.apache.mahout.cf.taste.impl.eval;
 
-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.cf.taste.common.NoSuchUserException;
 import org.apache.mahout.cf.taste.common.TasteException;
 import org.apache.mahout.cf.taste.eval.DataModelBuilder;
@@ -213,7 +213,7 @@ public final class GenericRecommenderIRStatsEvaluator implements RecommenderIRSt
                                        DataModel dataModel) throws TasteException {
     PreferenceArray prefs2Array = dataModel.getPreferencesFromUser(userID2);
     if (id == userID2) {
-      List<Preference> prefs2 = new ArrayList<Preference>(prefs2Array.length());
+      List<Preference> prefs2 = Lists.newArrayListWithCapacity(prefs2Array.length());
       for (Preference pref : prefs2Array) {
         prefs2.add(pref);
       }