Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static <K> K getGenericList(List<K> result) { if (result == null || result.isEmpty()) { return null; } else { return result.stream().findAny().get(); } } }