Charleswang8711
10/21/2019 - 3:04 AM

No More reduplication

List<DataUpLoadEntity> sessionDefectAndShiftData = TransData.stream()
 .filter(entity -> Integer.parseInt(parseChildStrByID(entity,2)) == 1
 && parseChildStrByID(entity,3).equals("start"))
 .collect(Collectors.toList());
 
 List<DataUpLoadEntity> sessionDefectAndShiftData = TransData.stream()
  .filter(entity -> parseChildStrByID(entity,3).equals("start"))
.collect(Collectors.toList());

==================>

Stream<DataUpLoadEntity> transactionsStream = TransData.stream();
   List<DataUpLoadEntity> sessionEntities = transactionsStream
   .filter(entity -> parseChildStrByID(entity,3).equals("prestart-session"))
   .collect(Collectors.toList());