I want to sort this
LG Electronics 1.jpg
Apple 2.JPG
Apple 3.JPG
As
Apple 2.JPG
Apple 3.JPG
LG Electronics 1.jpg
Here is my code //rows is 2d
ArrayList<String[]> rows = new ArrayList<>();
for(int i=0;i<images.length;i++){
com.drew.metadata.Metadata metadata = ImageMetadataReader.readMetadata(images[i]);
for (com.drew.metadata.Directory directory : metadata.getDirectories()) {
for (Tag tag : directory.getTags()) {
//System.out.println(tag.toString());
if(tag.toString().contains("[Exif IFD0] Make")){
rows.add(new String[]{tag.getDescription(),images[i].toString()});
}
}
}
}
I have implemented Collections.sort(rows);
but nothing works for me. I even tried
Collections.sort(rows, new Comparator<ArrayList<String>>() {
@Override
public int compare(ArrayList<String> o1, ArrayList<String> o2) {
return o1.get(0).compareTo(o2.get(0));
}
});
But it also doesn't works for me. I got this error that no suitable method found for sort(arraylist