Actually I want to sort Array List of objects. I am using Comparable interface for this purpose. It is completely working But the problem is that when I am sorting is is giving these two problems.
All name who have 1st letter capital are coming together on the top and all name who have 1st letter small are coming together on the bottom.
All the sorted Capital letters word are coming together after that all the small letter words are coming at bottom together.
Here is my bean
MyShares.java
public class Myshares implements Comparable<Myshares> {
int id, parent;
String name, path, type, shared_with, shared_or_not, upload_request;
public int getParent() {
return parent;
}
public void setParent(int parent) {
this.parent = parent;
}
public String getUpload_request() {
return upload_request;
}
public void setUpload_request(String upload_request) {
this.upload_request = upload_request;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getShared_with() {
return shared_with;
}
public void setShared_with(String shared_with) {
this.shared_with = shared_with;
}
public String getShared_or_not() {
return shared_or_not;
}
public void setShared_or_not(String shared_or_not) {
this.shared_or_not = shared_or_not;
}
@Override
public int compareTo(Myshares another) {
return this.name.compareTo(another.getName());
}
}
This is the output
I think it is based on ASCII code. I want a complete sorted list. Please take a look.