Reputation: 609
I'm working in Android with opencv library. I found some code in c++ for image processing which contains the following line:
vector<pair<CvPoint, pair<double, double> > > hlines;
How can I create a structure like this in android in order to save a point and two doubles?
Upvotes: 0
Views: 222
Reputation: 223153
Java doesn't have pairs; Java programmers tend to write their own class for that kind of thing. e.g.,
class HLine {
public final CvPoint point;
public final double x;
public final double y;
public HLine(CvPoint point, double x, double y) {
this.point = point;
this.x = x;
this.y = y;
}
}
Then you can just create an ArrayList<HLine>
.
Upvotes: 3
Reputation: 280
you should have a look at Arraylist...... it is also a array but you don't have to define the size of it... syntax :
ArrayList<datatype> variable_name=new ArrayList<datatype>();
Upvotes: 0