Java tutorial
//package com.java2s; import java.util.List; import java.util.Map; public class Main { public static <T> T carelessGet(List<T> list, int position) { if (list == null || position >= list.size()) { return null; } else { return list.get(position); } } public static <T> T carelessGet(Map<String, T> map, String key) { if (map == null || key == null) { return null; } else { return map.get(key); } } }