java - Values Clustering -


in text file data distributed shown below, considering table ease.

  column1 column2 column3 column4               b      1       2               b      1       5              c      1       3      b          c      2       3     c               3       4              b      4       5 

i need cluster the same values if column1 , column2 same, a->b repeated 3 times combine this.

          b      1       2            b      1       5           b      4       5 

here's how it.

  1. define class record containing 4 fields
  2. define class recordkey containing identification of row, i.e. 2 first column values. make sure equals , hashcode defined.
  3. create map<recordkey, list<record>>.
  4. read records line line. if there list in map current record key, add current record list. otherwise, create new list, add record it, , put list in map.

Comments

Post a Comment

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -