我有三个列表,现在我要将它们合并为一个列表。
我有一个没有空格的用户输入。
所有用户输入中的单词都已经在“allLists”中。我想要遍历“allLists”,并在找到每个单词时向字符串中插入空格。结果应该是:
static List allLists = Stream.of(list1, list2, list3)
.flatMap(Collection::stream)
.collect(Collectors.toList());
我有一个没有空格的用户输入。
String = "HelloIwanttobookanonlineseminaratyourcompany"
所有用户输入中的单词都已经在“allLists”中。我想要遍历“allLists”,并在找到每个单词时向字符串中插入空格。结果应该是:
String = "Hello I want to book an online seminar at your company"
有没有我错过的简单解决方案?
allList
中有"he"、"hello"和"llo"(如果我们可以假设"llo"是可接受的单词),那该怎么办? - zlakad