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.
- define class record containing 4 fields
- define class recordkey containing identification of row, i.e. 2 first column values. make sure equals , hashcode defined.
- create
map<recordkey, list<record>>
. - 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.
Great content! Super high-quality! Keep it up!
ReplyDeletePython Tkinter Frame Widget
Python Tkinter Checkbutton Widget
Python Tkinter Combobox Event Binding
Python Tkinter Combobox
Python Tkinter Text Widget