Wednesday, 15 August 2012

excel - How to store cell positions(row,column) in Java? -


I have to store some room position in Excel file to compare later. East. (1,6) (1,17) (2,6) (2,17) where 1 -> line, 6 -> column

I do not know which collections used in Java for this To do.

A mapping must be present between the two values. I can not use the map because the main values ​​are not unique

Any suggestions are welcome.

map & lt; Integer, list & lt; Integer & gt; & Gt; or Maps & lt; Integer, set & lt; Integer & gt; & Gt; , and a way to build again, if you have row value, you will be able to get all related column values. To make it easier to use, you can wrap it to a custom category like this:

  Category status {Private map & lt; Integer, set & lt; Integer & gt; & Gt; Posts = new hashmap & lt; & Gt; (); Zero plus (int row, integer column) {set & lt; Integer & gt; Column = this column formula (line); Columnss.add (column); This.positions.put (row, column); } Set up & lt; Integer & gt; ColumnsFromRow (int row) {Set & lt; Integer & gt; Column = this.positions.get (line); If (column == zero) {column = new hashset & lt; & Gt; (); } Return column; } Return boolean isTherePosition (integer row, EIT column) {this.columnFromRow (line). Includes (column); }}  

No comments:

Post a Comment