我想返回一个包含响应中的用户名的字符串ArrayList,响应代码为200。

huangapple go评论82阅读模式
英文:

I want to return back a Arraylist of string which contains userName in the response with the response code 200

问题

我想要返回一个字符串的ArrayList,其中包含响应中的userName,并且响应代码为200。如何实现这个?提前谢谢。

英文:

I want to return back a Arraylist of string which contains userName in the response with the response code 200. How to implement this.Thanks in advance.

答案1

得分: 1

ResponseEntity<List<String>> someMethod() {
    List<String> userNames = getvalues();
    return new ResponseEntity<>(userNames, OK);
}
英文:
ResponseEntity&lt;List&lt;String&gt;&gt; someMethod() {
   List&lt;String&gt; userNames = getvalues();
   return new ResponseEntity&lt;&gt;(userNames, OK);
}

huangapple
  • 本文由 发表于 2020年9月9日 17:02:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/63808283.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定