I found a class declaration that works for me, but I wonder if this class could be written more "short":
public class Data implements Comparable <Data>{
public Data (int category, String quality, String title ) {
super();
this.category = category;
this.quality = quality;
this.title = title;
}
int category;
String quality;
String title;
@Override
public int compareTo(Data d) {
return this.getDuration_value() - (d.getDuration_value());
}
}
Why do I have to mention "category, quality an title" this often ? And why "super()" ? I would like to have it just shorter. I found other explanations, but nowhere this "complex structure".
The "data" is given by these lines, and I want that I do not have to declare in advance the length of the array:
Data[] myDataArray = {
new Data(0, // category "0"
"***", // quality
"MyTitle1") // title
new Data(0, // same category "0"
"**", // quality
"MyTitle2") // title
}