Changeset 34950c6 for phonelux-backend/src/main/java/finki/it/phoneluxbackend/services/PhoneOfferService.java
- Timestamp:
- 09/22/22 03:14:04 (2 years ago)
- Branches:
- master
- Children:
- 436e0da
- Parents:
- d66b8eb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
phonelux-backend/src/main/java/finki/it/phoneluxbackend/services/PhoneOfferService.java
rd66b8eb r34950c6 231 231 .map(cpu -> cpu.split("\n")[0].stripIndent().replaceAll("\n","")) 232 232 .filter(cpu -> !cpu.contains("Snapdragon") && !cpu.contains("Exynos")) 233 .filter(cpu -> Character.isAlphabetic(cpu.charAt(0))) 233 234 .distinct() 234 235 .sorted() … … 252 253 List<PhoneOffer> offers = phoneOfferRepository.findAll(); 253 254 254 returnoffers.stream()255 List<String> cameras = offers.stream() 255 256 .map(PhoneOffer::getBack_camera) 256 257 .filter(camera -> camera != null && !camera.equals("") && !camera.equals("/")) 257 258 .map(camera -> camera.split("[\n,]")[0].replaceAll("\t","")) 258 .distinct() 259 .sorted() 260 .collect(Collectors.toList()); 259 .flatMap(camera -> Arrays.stream(camera.split("[+/]"))) 260 .map(camera -> camera.replaceAll("MP","").stripIndent()) 261 .distinct() 262 .sorted() 263 .collect(Collectors.toList()); 264 265 cameras.stream() 266 .forEach(camera -> { 267 if(Character.isDigit(camera.charAt(0))) 268 cameras.set(cameras.indexOf(camera), camera+"MP"); 269 270 }); 271 272 return cameras; 261 273 } 262 274 … … 267 279 .map(PhoneOffer::getBattery) 268 280 .filter(battery -> battery != null && !battery.equals("") && !battery.equals("/")) 269 .map(battery -> battery.split(",")[0].stripIndent()) 281 .map(battery -> battery.split(",")[0] 282 .split("\n")[0] 283 .replaceAll("'","") 284 .replaceAll("\t"," ") 285 .stripIndent()) 286 .map(battery -> battery.replaceAll("battery", "").stripIndent()) 270 287 .distinct() 271 288 .sorted(Comparator.reverseOrder())
Note:
See TracChangeset
for help on using the changeset viewer.