What is your practical experience working with various network protocols and their applications?
Java
What is the difference between an enumerator and an iterator in Java?
How can you sort a list of elements in your program?
What problems can arise from not using transactions in an application?
What factors influence data access speed in SQL?
What does Maven provide when building a project?
Какой тип коллекции лучше выбрать для хранения уникальных элементов в отсортированном порядке?
In what situations is it recommended to use the CopyOnWriteArrayList data structure in a multithreaded environment?
Does the keyword volatile guarantee the order of operations in a multithreaded environment and how is it related to the Happens-before model?
How to merge two different branches in Git?
Can a value in a column with a FOREIGN KEY constraint be NULL?
What is the difference between map and flatMap operations?
What access modifiers do fields and methods have in default interfaces?
What requirements are imposed on a class for proper work with Hibernate?
Read the code and highlight errors. /** * A client with a purchased ticket can choose a specific seat for an additional fee. * The base price of seats is determined by tariffs (external service). * For clients with certain tariffs (PREMIUM, ULTRA), a discount is applied at payment. * When booking, an invoice is issued to the client for payment. Payment management is handled by a third-party service. */ @Service public class SeatBookingService { @Autowired private SeatBookingRepository seatBookingRepository; @Autowired private TicketRepository ticketRepository; @Autowired private TariffClient tariffClient; @Autowired private CustomerClient customerClient; @Autowired private PaymentClient paymentClient; /** * Booking. * @param seatCode seat code (e.g., 19A) * @param ticketId ticket ID */ @Transactional public void bookSeat(String seatCode, UUID ticketId) { var ticket = ticketRepository.findById(ticketId); //book var seatBooking = new SeatBooking(seatCode, ticket.get().getFlightId(), ticketId, BookingStatus.BOOKED); seatBookingRepository.save(seatBooking); //find base tariff for the selected seat on the plane var basePrice = tariffClient.getBasePrice(ticket.get().getPlaneModel(), seatCode); //find customer data Long userId = (Long) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); var userData = customerClient.getCustomer(userId); System.out.println("User found " + userData.getFio() + " document number " + userData.getDocument()); var price = basePrice; if (userData.getTariff() == "PREMIUM") { //50% discount price = basePrice * 0.5d; } if (userData.getTariff() == "ULTRA") { //20% discount price = basePrice * 0.8d; } var invoice = new Invoice(price, ticketId, userId); //issue invoice paymentClient.sendInvoice(invoice); System.out.println("Invoice issued"); } @Data @Table("seat_booking") public class SeatBooking { @Column private String seatCode; @Column private UUID flightId; @Column private UUID ticketId; @Column private BookingStatus status; } public enum BookingStatus { BOOKED, PAID; }
Can you list the types of classes that exist in Kotlin?
Why are ArrayList and array the fundamental data structures in Java?
What types of table joins have you used in your SQL queries?
In which cases is the Round Robin algorithm optimal?
How can you obtain a stream of elements from a collection as a Map using the Stream API?