我想从包含整数的列表的值创建一个带有 String.format 的字符串,如下所示 String.format("Q1={}, Q2={}, Q3={}, Q4={}" list) 。
private String createString(Player player){
List<Integer> answers= new ArrayList<>();
answers.add(player.getQuestion1());
answers.add(player.getQuestion2());
answers.add(player.getQuestion3());
answers.add(player.getQuestion4());
answers.add(player.getQuestion5());
answers.add(player.getQuestion6());
answers.add(player.getQuestion7());
answers.add(player.getQuestion8());
answers.add(player.getQuestion9());
answers.add(player.getQuestion10());
return String.format("Q1={}, Q2={}, Q3={}, Q4={}, Q5={}, Q6={}, Q7={}, Q8={}, Q9={}, Q10={}", answers.stream().map(a -> a.toString());
}
肥皂起泡泡
婷婷同学_
素胚勾勒不出你
相关分类