Java tutorial
//package com.java2s; import java.util.Collection; public class Main { public static <T> boolean isOutOfBound(Collection<T> coll, int index) { if (isEmpty(coll)) { return true; } if ((index >= coll.size()) || (index < 0)) { return true; } else { return false; } } public static <T> boolean isEmpty(Collection<T> coll) { if (coll == null || coll.size() == 0) { return true; } return false; } }