This commit is contained in:
Carsten Otto
2021-12-06 20:16:28 +01:00
parent 6826ccd7d9
commit e8be5d58a4
6 changed files with 9 additions and 16 deletions

View File

@@ -26,7 +26,6 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/api/node/{pubkey}")
@@ -113,6 +112,6 @@ public class NodeController {
return channels.stream()
.map(Channel::getId)
.sorted()
.collect(Collectors.toList());
.toList();
}
}

View File

@@ -16,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/api/status/")
@@ -49,7 +48,7 @@ public class StatusController {
.map(LocalOpenChannel::getId)
.sorted()
.distinct()
.collect(Collectors.toList());
.toList();
return new ChannelsDto(channelIds);
}
@@ -60,7 +59,7 @@ public class StatusController {
.map(LocalOpenChannel::getRemotePubkey)
.sorted()
.distinct()
.collect(Collectors.toList());
.toList();
return new PubkeysDto(pubkeys);
}
@@ -71,7 +70,7 @@ public class StatusController {
.map(LocalChannel::getId)
.sorted()
.distinct()
.collect(Collectors.toList());
.toList();
return new ChannelsDto(channelIds);
}
@@ -82,7 +81,7 @@ public class StatusController {
.map(LocalChannel::getRemotePubkey)
.sorted()
.distinct()
.collect(Collectors.toList());
.toList();
return new PubkeysDto(pubkeys);
}

View File

@@ -4,10 +4,9 @@ import de.cotto.lndmanagej.model.Pubkey;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
public record PubkeysDto(List<String> pubkeys) {
public PubkeysDto(Collection<Pubkey> pubkeys) {
this(pubkeys.stream().map(Pubkey::toString).collect(Collectors.toList()));
this(pubkeys.stream().map(Pubkey::toString).toList());
}
}