You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sm...@apache.org on 2013/11/03 20:20:18 UTC

svn commit: r1538421 - /mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/JsonClusterWriter.java

Author: smarthi
Date: Sun Nov  3 19:20:18 2013
New Revision: 1538421

URL: http://svn.apache.org/r1538421
Log:
Mahout-1343: monor code cleanups

Modified:
    mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/JsonClusterWriter.java

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/JsonClusterWriter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/JsonClusterWriter.java?rev=1538421&r1=1538420&r2=1538421&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/JsonClusterWriter.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/JsonClusterWriter.java Sun Nov  3 19:20:18 2013
@@ -20,11 +20,11 @@ import java.io.IOException;
 import java.io.Writer;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
 
+import com.google.common.collect.Maps;
 import org.apache.mahout.clustering.AbstractCluster;
 import org.apache.mahout.clustering.Cluster;
 import org.apache.mahout.clustering.classify.WeightedVectorWritable;
@@ -67,7 +67,7 @@ public class JsonClusterWriter extends A
    */
   @Override
   public void write(ClusterWritable clusterWritable) throws IOException {
-    HashMap<String, Object> res = new HashMap<String, Object>();
+    Map<String, Object> res = Maps.newHashMap();
 
     // get top terms
     List<Object> topTerms = getTopFeaturesList(clusterWritable.getValue()
@@ -120,7 +120,7 @@ public class JsonClusterWriter extends A
         log.error("Dictionary entry missing for {}", index);
         continue;
       }
-      HashMap<String, Object> term_entry = new HashMap<String, Object>();
+      Map<String, Object> term_entry = Maps.newHashMap();
       term_entry.put("term", dictTerm);
       term_entry.put("weight", vectorTerms.get(i).weight);
       topTerms.add(term_entry);
@@ -141,7 +141,7 @@ public class JsonClusterWriter extends A
 
     if (points != null) {
       for (WeightedVectorWritable point : points) {
-        HashMap<String, Object> entry = new HashMap<String, Object>();
+        Map<String, Object> entry = Maps.newHashMap();
         Vector theVec = point.getVector();
         if (theVec instanceof NamedVector) {
           entry.put("vector_name", ((NamedVector) theVec).getName());