/** Matches equals(), does not take order into account. */ @Override public int hashCode(){ URLParameters ps=sort(); String s=ps.toString(); return s.hashCode(); }
/** URLParameters objects are equal if the have the same keys and values. * The order is not relevant. * This is the same as in http. */ @Override public boolean equals(Object o){ if(o==null)return false; if(this==o)return true; if(!(o instanceof URLParameters))return false; URLParameters ps=(URLParameters)o; URLParameters a=sort();//can I avoid this? URLParameters b=ps.sort(); String as=a.toString();//can I avoid this? String bs=b.toString(); return as.equals(bs); }