字符串无法转换为T java lambda表达式

字符串无法转换为T java lambda表达式,java,lambda,Java,Lambda,如何解决此错误? 我的代码是: public Future<Set<Client>> getAllClients(){ Future<Set<Client>> result = executorService.submit(() -> { Message request = new Message(HelloService.GETALL, ""); Message response = tcpCli

如何解决此错误? 我的代码是:

  public Future<Set<Client>> getAllClients(){
    Future<Set<Client>> result = executorService.submit(() -> {
        Message request = new Message(HelloService.GETALL, "");
        Message response = tcpClient.sendAndReceive(request);
        String body =response.body();
        return body;
    });
    return result;
}
public Future getAllClients(){
未来结果=executorService.submit(()->{
消息请求=新消息(HelloService.GETALL,“”);
消息响应=tcpClient.sendAndReceive(请求);
字符串body=response.body();
返回体;
});
返回结果;
}

您的表达式应该生成/返回一个
集合
。不能只返回
字符串
。假设这是可能的,您需要将字符串解析为这些对象的集合。您的字符串是否由一些可以分解的部分组成,例如使用字符串分隔符?因此,您可以使用字符串将汇编程序写入assembly
Set
。。然而,这样做是很不自然的。您最好从
tcpClient服务
返回
Set