blob: d0bdfaa556afcbf8ece89e79ce132aae58547145 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
package com.mavlushechka.a1qa.utils;
import com.mavlushechka.a1qa.models.Post;
import java.util.List;
import java.util.stream.IntStream;
public class Posts {
public static boolean isPostsAscending(List<Post> posts) {
return IntStream.range(1, posts.size())
.map(index -> posts.get(index - 1).compareTo(posts.get(index)))
.allMatch(order -> order <= 0);
}
}
|