我有List<List<Double>>
。我想根据索引过滤行,即如果索引4处的元素值小于0.2,那么,跳过该行?结果List<List<Double>>
应该小于或等于输入的 MPMoviePlayerViewController * moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:local_url];
moviePlayer.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[moviePlayer.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
[moviePlayer.view setTranslatesAutoresizingMaskIntoConstraints:YES];
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
。
答案 0 :(得分:3)
您可以使用Stream.filter
。请注意,您必须选择要采用的行,而不是要跳过的行:
List<List<Double>> input = ...;
List<List<Double>> result = input.stream()
.filter(row -> row.get(4) >= 0.2)
.collect(Collectors.toList());
Stream API的替代方法是使用Collection.removeIf
进行就地修改:
List<List<Double>> input = ...;
input.removeIf(row -> row.get(4) < 0.2);