...
|
...
|
@@ -338,25 +338,4 @@ public class UserRecallResponseBuilder { |
|
|
}
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
List<Integer> userPriceAreas = new ArrayList<>();
|
|
|
userPriceAreas.addAll(Arrays.asList(5, 6, 7));
|
|
|
Collections.sort(userPriceAreas);
|
|
|
int min = userPriceAreas.get(0);
|
|
|
int max = userPriceAreas.get(userPriceAreas.size() - 1);
|
|
|
int leftCount = min <= 1 ? 0 : max >= 7 ? 2 : 1;
|
|
|
int rightCount = min <= 1 ? 2 : max >= 7 ? 0 : 1;
|
|
|
for (int i = 1; i <= leftCount; i++) {
|
|
|
if (min - i >= 1) {
|
|
|
userPriceAreas.add(0, min - i);
|
|
|
}
|
|
|
}
|
|
|
for (int i = 1; i <= rightCount; i++) {
|
|
|
if (max + i <= 7) {
|
|
|
userPriceAreas.add(max + i);
|
|
|
}
|
|
|
}
|
|
|
System.out.println(userPriceAreas);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|