public static <A extends Comparable<A>> void insertSorted(A a, List<A> as, Comparator<? super A> comparator) {
		int index = Collections.binarySearch(as, a, comparator);
		if (index<0) {
			index = -index -1;
		}
		as.add(index, a);
	}