Answers for "csv file data structure java"

0

csv file data structure java

if you have a lot of holes in you CSV use the comparable as your coordinate
public class Coordinate implements Comparable<Coordinate> {
    public int row;
    public int column;
    public Coordinate(int r, int c) {
        row = r;
        column = c;
    }

    @Override
    public int compareTo(Coordinate o) {
        int r = Integer.compare(row, o.row);
        if(r == 0) {
            r = Integer.compare(column, o.column);
        }
        return r;
    }

    public boolean equals(Object o) {
        if(o instanceof Coordinate) {
            Coordinate c = (Coordinate)o;
            return row == c.row && column == c.column;
        }
        return false;
    }
}
Posted by: Guest on October-20-2020
0

csv file data structure java

HashMap<String, List<String>>
//csv file has 3 columns first column can be used as key
Posted by: Guest on October-20-2020
0

csv file data structure java

List<List<String>> csv = new ArrayList<>();
//Generic answer
Posted by: Guest on October-20-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language