mirror of
https://github.com/jlengrand/quarkus-workshop.git
synced 2026-03-10 08:41:21 +00:00
Use IntStream instead of int[] (#8)
Use an `IntStream` instead of an `int[]` array.
This commit is contained in:
committed by
James Falkner
parent
b9adb3cd0e
commit
61c85adac3
@@ -252,7 +252,7 @@ StarWarsService swService; // <1>
|
||||
@Path("/swpeople")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public List<StarWarsPerson> getCharacters() {
|
||||
return Arrays.stream(new int[] {1, 2, 3, 4, 5}) // <2>
|
||||
return IntStream.range(1, 6) // <2>
|
||||
.mapToObj(swService::getPerson) // <3>
|
||||
.collect(Collectors.toList()); // <4>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user