Skip to content

Commit

Permalink
Use set.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Apr 19, 2024
1 parent 8098927 commit 505ae28
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@
import java.io.IOException;
import java.net.URI;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand Down Expand Up @@ -109,14 +108,14 @@ public Set<Sharee> getSharees(final Type type) throws BackgroundException {
Collections.singletonList(Sharee.world)
);
try {
sharees.addAll(session.getClient().execute(resource, new OcsResponseHandler<List<Sharee>>() {
sharees.addAll(session.getClient().execute(resource, new OcsResponseHandler<Set<Sharee>>() {
@Override
public List<Sharee> handleEntity(final HttpEntity entity) throws IOException {
public Set<Sharee> handleEntity(final HttpEntity entity) throws IOException {
final XmlMapper mapper = new XmlMapper();
final ocs value = mapper.readValue(entity.getContent(), ocs.class);
if(value.data != null) {
if(value.data.users != null) {
final List<Sharee> sharees = new ArrayList<>();
final Set<Sharee> sharees = new HashSet<>();
for(ocs.user user : value.data.users) {
final String id = user.value.shareWith;
final String label = String.format("%s (%s)", user.label, user.shareWithDisplayNameUnique);
Expand All @@ -125,7 +124,7 @@ public List<Sharee> handleEntity(final HttpEntity entity) throws IOException {
return sharees;
}
}
return Collections.emptyList();
return Collections.emptySet();
}
}
));
Expand Down

0 comments on commit 505ae28

Please sign in to comment.