Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { static <T extends Comparable<T>> T getNthElement(int n, List<T> list) { List<T> newList = new ArrayList<T>(list); Collections.sort(newList); return newList.get(n); } }