Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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);
    }
}