我想 return 返回一个字符串数组列表,它在响应中包含用户名,响应代码为 200

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

我想return返回一个字符串数组列表,其中包含响应代码200的响应中的userName。如何提前实现this.Thanks。

ResponseEntity<List<String>> someMethod() {
   List<String> userNames = getvalues();
   return new ResponseEntity<>(userNames, OK);
}