AFAIK,一些可能的转换是
List<String> stringList = integerList.stream().map(Object::toString)
.collect(Collectors.toList());
Run Code Online (Sandbox Code Playgroud)
和
List<Integer> integerList = stringList.stream()
.map(Integer::valueOf).collect(Collectors.toList());
Run Code Online (Sandbox Code Playgroud)
是否有像上面这样的转换从字符串列表转换为字符列表?
考虑以下示例并提出处理此问题的正确方法或清除我的思想中的这种想法
data(){
return{
a: true,
b: 5
}
},
someMethod: function(){
/*Currently update using the following lines,
this.a = false
this.b = 6
*/
//Is there anything to update multiple attributes at a single line
//Like in ReactJS
//this.setState({})
//Or correct my VueJS knowledge if im wrong
}
Run Code Online (Sandbox Code Playgroud) 输入将是,像,
iii,我非常喜欢java soooo
而预期的输出就像
嗨,我非常喜欢java
对于我的模糊编码如下,
List<String> wordList = Arrays.asList(word.split(""));
String previousCharacter;
boolean inneFlag = false;
boolean flag = false;
int iterator = 0;
int characterIterator = 0;
String finalizedWord = "";
previousCharacter = wordList.get(0);
for(String character : wordList){
if((wordList.size()-1)==characterIterator){
inneFlag = true;
}
if(flag){
if(character.equalsIgnoreCase(previousCharacter)){
iterator++;
if(inneFlag){
if(iterator>2){
finalizedWord = finalizedWord.substring(0,(finalizedWord.length()-iterator));
}
}
}else{
previousCharacter = character;
if(iterator>=2){
finalizedWord = finalizedWord.substring(0,(finalizedWord.length()-iterator));
}
iterator = 0;
}
}else{
flag = true;
}
characterIterator++;
finalizedWord += character;
}
Run Code Online (Sandbox Code Playgroud)
谁能给出更好的解决方案?