What is work-life balance?
ERP Consultant
What is the complexity of inserting an element into a HashSet?
What is the purpose of the acks parameter in Kafka settings?
How was the CI/CD process organized? Who was responsible — developers or separate DevOps?
By default, where does CompletableFuture execute?
Tell me about the Circuit Breaker pattern. What is it used for, and what modes are available?
How long have you been working with microservices?
What is the Mediator pattern, have you worked with it?
What is considered a blocking operation in asyncio? Is creating a list of a billion elements a blocking operation?
What is the difference between stocks and bonds?
What does it depend on — who is allowed to work remotely and who is not?
What do you know about the Strategy pattern?
What is the difference between TLS and mTLS connections?
How would you implement your own asynchronous timeout?
package com.example.photogallery.controller; import com.example.photogallery.model.Photo; import com.example.photogallery.service.PhotoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.util.ArrayList; import java.util.List; @RestController @RequestMapping("/api/photos") public class PhotoController { @Autowired private PhotoService photoService; private List<Photo> photos = new ArrayList<>(); private static Integer totalCount = 0; @GetMapping public List<Photo> getAllPhotos() { return photos; } @PostMapping("/upload") public String uploadPhoto(@RequestParam("file") MultipartFile file) { try { Photo photo = new Photo(); photo.setFileName(file.getOriginalFilename()); photo.setFileSize(file.getSize()); photo.setContentType(file.getContentType()); photos.add(photo); totalCount++; photoService.savePhoto(photo); return "Photo uploaded successfully"; } catch (Exception e) { return "Error uploading photo"; } } @GetMapping("/count") public Integer getCount() { return totalCount; } @DeleteMapping("/{id}") public void deletePhoto(@PathVariable Long id) { for (Photo photo : photos) { if (photo.getId().equals(id)) { photos.remove(photo); totalCount--; photoService.deletePhoto(id); break; } } } @GetMapping("/search") public List<Photo> searchPhotos(@RequestParam(required = false) String query) { if (query.isEmpty()) { return photos; } List<Photo> results = new ArrayList<>(); for (int i = 0; i < photos.size(); i++) { if (photos.get(i).getFileName().contains(query)) { results.add(photos.get(i)); } } return results; } }
Can interfaces have methods with implementation or not?
Share your experience and role in recent projects, technology stack.
How to effectively use ConcurrentHashMap to gain advantages?
What is the difference between non-repeatable read and phantom read?
Can you start work earlier in the day so you finish by 5 o'clock?