public static <T> T getItemAtPositionOrNull(Collection<T> collection, int position) {
        if (position >= collection.size() || position < 0) {
            return null;
        }
        if (collection instanceof List) {
            return ((List<T>) collection).get(position);
        }
        Iterator<T> iterator = collection.iterator();
        T item = null;
        for (int i = 0; i < position + 1; i++) {
            item = iterator.next();
        }
        return item;
    }
@Test
    public void testGetItemAtPositionOrNull_whenNegativePosition_thenReturnNull() {
        Object obj = new Object();
        Collection<Object> src = new ArrayList<>();
        src.add(obj);

        Object result = getItemAtPositionOrNull(src, -1);

        assertNull(result);
    }