public static <T> T getOrDefault(Object obj, int index, T defaultValue) {
        try {
            return (T) get(obj, index);
        } catch (IndexOutOfBoundsException e) {
            return defaultValue;
        }
    }
@Test
    void testGetOrDefault() {
        assertEquals("default", CollectionUtils.getOrDefault(Collections.emptyList(), 1, "default"));
        assertEquals("element", CollectionUtils.getOrDefault(Collections.singletonList("element"), 0, "default"));
    }