public List<Interval> insert(List<Interval> list, Interval ni) {
		for (ListIterator<Interval>i=list.listIterator();i.hasNext();) {
			if (i.next().start>ni.start) {
			    i.previous();
				i.add(ni);
				ni=null;
				break;
			}
		}
		if (ni!=null)
		    list.add(ni);
		List<Interval>rel=new ArrayList<>();
		for (ListIterator<Interval>i=list.listIterator();i.hasNext();) {
			Interval itv=i.next();
			Interval last=rel.isEmpty()?null:rel.get(rel.size()-1);
			if (rel.isEmpty()||itv.start>last.end)
				rel.add(itv);
			else {
				last.end=Math.max(last.end, itv.end);
			}
		}
		return rel;
	}