class Obj{ HashMap<String,Double> v = new HashMap<>(); public double distance(Obj o){ double s = 0; for(String k:v.keySet()){ s += (o.v.containsKey(k))?(Math.pow(o.v.get(k)-v.get(k),2)):(0); } if(s == 0)return 0; return Math.sqrt(s)...
メンバ関数に public void set(String k,double d){ v.put(k,d); } を入れた方が美しかったな 反省