1 for (int i=0; i<paymentList.size(); i++) {
2 listClassDate.addAll(
3 getClassDateList(paymentList.get(i).getClassIdx())
3 );
5 }
6
7 HashSet tmpClassDate = new HashSet(listClassDate);
8 listClassDate = new ArrayList<>(tmpClassDate);
9
10 Collections.sort(listClassDate);
11
12 for (String classDate : listClassDate) {
13 contentsList.addAll(getSeriesClassBook(
14 selectedSeries.getSeriesCode(),
15 classDate,
16 paymentList
17 )
18 );
19 }
I'm converting a project from Java to PHP, but since I know little about Java, quite hard to convert it. My problem on the code above are the following:
HashSet
does to listClassDate? How can i make this in PHP? for (String classDate ...
. I haven't tried "strings in PHP for loop" because i'm assuming classDate
is always array in PHP. Parameters for getSeriesClassBook()
method:
getSeriesClassBook(String seriesCode, String classDate, List paymentList)
1) It's a quick way to remove duplicates from the list. They makes a set by copying the list, which automatically removes duplicates. They then put it back into a list again.
2) It just a foreach loop. The same concept exists in PHP .
I don't understand question 3.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.