@SuppressWarnings("unchecked")
	public static <E> List<E> firstKItems(List<E>list,int k){
		Queue<E>pq=new PriorityQueue<>(k, (a,b)->((Comparable<?super E>)b).compareTo(a));
		for (E e:list)
			if (pq.size()<k) pq.offer(e);
			else if (((Comparable<?super E>)pq.peek()).compareTo(e)>0) {pq.poll();pq.offer(e);}
		return new ArrayList<>(pq);
	}