#653 - Use Java 8 Stream API.

This commit is contained in:
Kulcsár Roland
2017-10-15 14:00:40 +02:00
committed by Oliver Gierke
parent 7a5b7b1c9f
commit 4c7227e274
13 changed files with 91 additions and 161 deletions

View File

@@ -19,7 +19,6 @@ import lombok.Getter;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -99,11 +98,9 @@ public class DefaultCurieProvider implements CurieProvider {
@Override
public Collection<? extends Object> getCurieInformation(Links links) {
List<Curie> result = curies.entrySet().stream() //
return curies.entrySet().stream() //
.map(it -> new Curie(it.getKey(), getCurieHref(it.getKey(), it.getValue()))) //
.collect(Collectors.toList());
return Collections.unmodifiableCollection(result);
.collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableCollection));
}
/*

View File

@@ -914,13 +914,8 @@ public class Jackson2HalModule extends SimpleModule {
*/
public boolean hasCuriedEmbed(Iterable<?> source) {
for (String rel : map(source).keySet()) {
if (rel.contains(":")) {
return true;
}
}
return false;
return map(source).keySet().stream()
.anyMatch(rel -> rel.contains(":"));
}
}