亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Java使用List類的數(shù)據(jù)時(shí),像判斷某一個(gè)位置(N),是否為null值,更高效的寫法.
PHPz
PHPz 2017-04-18 10:36:17
0
4
577
PHPz
PHPz

學(xué)習(xí)是最好的投資!

reply all(4)
Ty80

Using Java8 only requires one line of code

List<Integer> list = new ArrayList<>();
if (list == null || list.isEmpty()){
    return Collections.emptyList();
}
return list.stream().filter(Objects::nonNull).limit(2).collect(Collectors.toList());
PHPzhong

ArrayListget(index)Don’t worry about the efficiency of the method. Your problem description and title seem unrelated. Can you understand it?

左手右手慢動(dòng)作

When the number of data items is determined, the backend only needs to return two items, and then it can be traversed directly. There is no need to make it so complicated...

Ty80

What does it mean that your question is difficult to understand? ! !
Do you mean something like “display in pages”? And dynamically return data based on the number of lists?
If this is the case, then you can use ArrayList and use the sort method of ArrayLiast to sort. After sorting, you can pick whichever item you want without any confusion.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template