我无法启动我的Vue.js应用程序
错误是:
import java.util.*;
import java.util.stream.*;
class Rank {
public static String nthRank(String st, Integer[] we, int n) {
System.out.println("\n\n\nNames: "+st+" weights: "+Arrays.toString(we)+" n: "+n);
if(st.isEmpty()) return "No participants";
String[] names = st.split(",");
if(n > names.length) return "Not enough participants";
String alphabet = "abcdefghijklmnopqrstuvwxyz";
int sum = 0;
Map<String, Integer> map = new HashMap<String, Integer>();
for(int i = 0; i < names.length; i++){
String currentName = names[i];
sum += currentName.length();
for(int j = 0; j < currentName.length(); j++){
char currentChar = Character.toLowerCase(currentName.charAt(j));
sum += alphabet.indexOf(currentChar) + 1;
}
map.put(currentName, sum*we[i]);
System.out.println("Map: "+map.toString());
sum = 0;
}
Comparator<Map.Entry> outerComparator = (pair1, pair2) -> {
if ((int)pair1.getValue() > (int)pair2.getValue()){
return 1;
}else if ((int)pair1.getValue() < (int)pair2.getValue()){
return -1;
}else{
return pair1.getKey().toString().compareTo(pair2.getKey().toString());
}
};
map = map.entrySet().stream()
.sorted(Map.Entry.comparingByValue(MapComparator.compare()))
.collect(Collectors.toMap(
Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
System.out.println("\n\nSorted Map: "+map.toString());
return map.keySet().toArray()[n-1].toString();
}
class MapComparator implements Comparator<Map.Entry> {
@Override
public int compare(Map.Entry pair1, Map.Entry pair2) {
int valueCompare = - ( pair1.getValue().compareTo(pair2.getValue()) );
int nameCompare = pair1.getKey().compareTo(pair2.getKey());
if (valueCompare == 0) {
return ((nameCompare == 0) ? valueCompare : nameCompare);
} else {
return valueCompare;
}
}
}
}
我试图按照其他论坛的建议降级到2.9.1版,但仍然无法正常工作
你能帮我吗?
谢谢
答案 0 :(得分:0)
尝试使用npm run serve
而不是npm run dev
来运行vue.js