Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting repository list #85

Merged
merged 3 commits into from Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -64,6 +64,8 @@
import java.net.Proxy;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
Expand Down Expand Up @@ -494,6 +496,12 @@ public List<BitbucketCloudRepository> getRepositories(@CheckForNull UserRoleInRe
throw new IOException("I/O error when parsing response from URL: " + url, e);
}
}
Collections.sort(repositories, new Comparator<BitbucketCloudRepository>() {
@Override
public int compare(BitbucketCloudRepository o1, BitbucketCloudRepository o2) {
return o1.getRepositoryName().compareTo(o2.getRepositoryName());
}
});
return repositories;
}

Expand Down
Expand Up @@ -62,6 +62,8 @@
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
Expand Down Expand Up @@ -472,6 +474,12 @@ public List<BitbucketServerRepository> getRepositories(@CheckForNull UserRoleInR
page = JsonParser.toJava(response, BitbucketServerRepositories.class);
repositories.addAll(page.getValues());
}
Collections.sort(repositories, new Comparator<BitbucketServerRepository>() {
@Override
public int compare(BitbucketServerRepository o1, BitbucketServerRepository o2) {
return o1.getRepositoryName().compareTo(o2.getRepositoryName());
}
});
return repositories;
} catch (FileNotFoundException e) {
return new ArrayList<>();
Expand Down