Java tutorial
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <T> T tryToGet2ndElement(List<T> list) { int size = list.size(); long id = 0; if (size < 2) { return list.get(0); } else { return list.get(1); } } }