How is the sequence of elements organized inside a TreeMap?
Java
Why are you currently looking for a job?
Tell about your experience implementing and working with Agile methodologies in projects.
What potential difficulties and limitations may arise when using Kafka in systems?
Can you list the main characteristics and features of the Spring framework?
What makes immutable objects safe to use in a multithreaded environment?
What is the role and purpose of functional interfaces in programming?
Have you worked with the Spring framework for application development?
What are the key components and stages involved in the Scrum process?
Объясните понятие согласованности данных в системах хранения информации.
Can a geographic query be included in the parameters of an HTTP GET request?
What are the main message delivery guarantees provided by Kafka according to its theoretical model?
What is the complexity level increase when adding every 1000 elements to an ArrayList?
In what cases and under what conditions can data loss occur in Kafka?
Can already closed data streams (Streams) in Java be reused?
What problems can arise if you modify a collection while iterating over it?
Implement a transfer of funds between two accounts. Note that this is a production solution Input parameters: @param fromAccountId the unique identifier of the user transferring funds @param toAccountId the unique identifier of the user receiving funds @param amount the transfer amount. A positive number public void transferMoney(Long fromAccountId, Long toAccountId, BigDecimal amount) { if (amount.compareTo(BigDecimal.ZERO) <= 0) { throw new RuntimeException("Amount must be > 0"); } if (fromAccountId.equals(toAccountId)) { throw new RuntimeException("Account can't be the same"); } Long firstId = Math.min(fromAccountId, toAccountId); Long secondId = Math.max(fromAccountId, toAccountId); Account first = accountRepository.findByIdForUpdate(firstId) .orElseThrow(() -> new RuntimeException("Account not found")); Account second = accountRepository.findByIdForUpdate(secondId) .orElseThrow(() -> new RuntimeException("Account not found")); Account from = fromAccountId.equals(firstId) ? first : second; Account to = fromAccountId.equals(firstId) ? second : first; if (from.getBalance().compareTo(amount) < 0) { throw new RuntimeException("Balance is Less 0"); } from.setBalance(from.getBalance().subtract(amount)); to.setBalance(from.getBalance().add(amount)); accountRepository.save(to); accountRepository.save(from); }
What motivates you to consider changing your current project?
Can you explain how the HashMap data structure works and how it provides fast access to elements?
Can you explain what Gson is and how it works with fields during serialization and deserialization?