Mahout
  1. Mahout
  2. MAHOUT-729

Refactoring: Use Maps.newHashMap() and Lists.newArrayList() from Guava globally

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 0.6
    • Component/s: None
    • Labels:
      None

      Description

      I put on my refactoring hat today and started to replace all calls to "new HashMap" with Maps.newHashMap() as well as all calls to "new ArrayList" with Lists.newArrayList() from Guava. This should make the code much more readable as the generic type of a variable needs to be written only once per line. I also refactored some minor things I encountered along the way.

      1. MAHOUT-729.patch
        426 kB
        Sebastian Schelter

        Activity

        Hide
        Hudson added a comment -

        Integrated in Mahout-Quality #877 (See https://builds.apache.org/job/Mahout-Quality/877/)
        MAHOUT-729 still more cleanup
        MAHOUT-729 more cleanup

        ssc : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1134468
        Files :

        • /mahout/trunk/src/conf/driver.classes.props

        ssc : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1134462
        Files :

        • /mahout/trunk/integration/src/test/java/org/apache/mahout/text/SequenceFilesFromMailArchivesTest.java
        • /mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/SplitBayesInput.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/BayesAlgorithm.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/SequenceFileModelReader.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/cbayes/CBayesThetaNormalizerMapper.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/common/mapreduce/VectorSumReducer.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/CBayesAlgorithm.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfMapper.java
        • /mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/arff/ARFFIterator.java
        • /mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/common/mapreduce
        • /mahout/trunk/examples/src/test/java/org/apache/mahout/classifier/bayes/SplitBayesInputTest.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierDriver.java
        • /mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensDataModel.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/eval/ParallelFactorizationEvaluator.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java
        • /mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/eval/InMemoryFactorizationEvaluator.java
        • /mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java
        • /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerMapper.java
        • /mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingDataModel.java
        • /mahout/trunk/integration/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/GenericJDBCDataModel.java
        • /mahout/trunk/integration/src/test/java/org/apache/mahout/utils/eval/ParallelFactorizationEvaluatorTest.java
        Show
        Hudson added a comment - Integrated in Mahout-Quality #877 (See https://builds.apache.org/job/Mahout-Quality/877/ ) MAHOUT-729 still more cleanup MAHOUT-729 more cleanup ssc : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1134468 Files : /mahout/trunk/src/conf/driver.classes.props ssc : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1134462 Files : /mahout/trunk/integration/src/test/java/org/apache/mahout/text/SequenceFilesFromMailArchivesTest.java /mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/SplitBayesInput.java /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/BayesAlgorithm.java /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/SequenceFileModelReader.java /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/cbayes/CBayesThetaNormalizerMapper.java /mahout/trunk/core/src/main/java/org/apache/mahout/common/mapreduce/VectorSumReducer.java /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/CBayesAlgorithm.java /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfMapper.java /mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/arff/ARFFIterator.java /mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java /mahout/trunk/core/src/main/java/org/apache/mahout/common/mapreduce /mahout/trunk/examples/src/test/java/org/apache/mahout/classifier/bayes/SplitBayesInputTest.java /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierDriver.java /mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensDataModel.java /mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/eval/ParallelFactorizationEvaluator.java /mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java /mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java /mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/eval/InMemoryFactorizationEvaluator.java /mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerMapper.java /mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingDataModel.java /mahout/trunk/integration/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/GenericJDBCDataModel.java /mahout/trunk/integration/src/test/java/org/apache/mahout/utils/eval/ParallelFactorizationEvaluatorTest.java
        Hide
        Sean Owen added a comment -

        Yeah I think that's a nice change if you're willing to do it, and the patch looks fine.

        Show
        Sean Owen added a comment - Yeah I think that's a nice change if you're willing to do it, and the patch looks fine.
        Hide
        Sebastian Schelter added a comment -

        will commit this in the next days if there are no objections

        Show
        Sebastian Schelter added a comment - will commit this in the next days if there are no objections

          People

          • Assignee:
            Sebastian Schelter
            Reporter:
            Sebastian Schelter
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development