Hunter0x7c7
2023-08-11 198dd6e1b210758867eed417bf6e00ba733d47c0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.github.hunter0x7c7.sync.utils;
 
 
import java.util.List;
 
public class ListUtil {
 
    public static <T> T getDataByList(T[] list, int index) {
        if (list != null && index < list.length && index >= 0) {
            return list[index];
        }
        return null;
    }
 
    public static <T> T getDataByList(List<T> list, int index) {
        if (list != null && index < list.size() && index >= 0) {
            return list.get(index);
        }
        return null;
    }
 
}