如何在 Java (REPL.it) 中打印数组列表并让我的代码扫描特定短语以突出显示元素?

问题描述

假设我有一个通过 wordscan 打印的 ArrayList 函数。 (像这样)(是的,这就是它的格式,抱歉。我会为需要它的人更正格式,但我不是要求重写,而是修复)

我想获取“forEach”变量,并在命令运行之前让代码运行“好吧,包含(玩家)变量的元素是否?如果是,则需要突出显示)”。任何帮助表示赞赏,并且可以并且将相应地进行更正。

System.out.print("\033[H\033[2J");
System.out.flush();
System.out.println(TEXT_GREEN + "WINNER LIST" + TEXT_RESET);
playerscore2.forEach(System.out::println);
System.out.println(TEXT_RED + "LOSER LIST" + TEXT_RESET);
playerscore3.forEach(System.out::println);
System.out.println("");
System.out.println("Do you think you're up to the challenge? (y/n)");```

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)