Предположим,
JSON:
[{
id=1,
name=name one,
desc=description one
}, {
id=4,
name=name four,
desc=description four
},{
id=3,
name=name three,
desc=description three
}, {
id=2,
name=name two,
desc=description two
}, {
id=0,
name=name zero,
desc=description zero
}]
JAVA:
List<Integer> recent3 = recentOrders.stream().map(m -> (int) m.get("id")).sorted().skip(Math.max(recentOrders.size() - 3, 0)).collect(Collectors.toList());