What is the main difference between using the map and flatMap methods in the Stream API when processing data streams?
Java
List<Integer> getNonUnique(int[] one, int[] two) { Map<Integer, Integer> freqOne = new HashMap<>(); Map<Integer, Integer> freqTwo = new HashMap<>(); for (int num : one) { freqOne.put(num, freqOne.getOrDefault(num, 0) + 1); } for (int num : two) { freqTwo.put(num, freqTwo.getOrDefault(num, 0) + 1); } List<Integer> result = new ArrayList<>(); for (Integer key : freqOne.keySet()){ if (freqTwo.containsKey(key)) { result.add(key); } } return result; } //one [phone] //two 3 9 8 1 // result 1 3 //one [phone] //two 3 9 8 1 3 // result 1 3 3
What types of tasks have you solved in your previous positions and how can they be characterized?
Can you explain how the HashMap data structure works and how it provides fast access to elements?
When creating an index for a large table, does it affect the ability to read data from it during its construction?
What methods are used to store external configuration data in applications?
table student id PK name faculty_id table faculty id PK name SELECT f.name, count(*) FROM faculty f JOIN student s ON s.faculty_id = f.id GROUP BY f.id, f.name GROUP BY /*f.id,*/ f.name GROUP BY f.id/*, f.name*/
Are you able to work with the OpenShift platform and apply it in projects?
table student id PK name faculty_id table faculty id PK name SELECT f.name FROM faculty f JOIN student s ON s.faculty_id = f.id GROUP BY f.id, f.name ORDER BY COUNT(s.id) DESC LIMIT 1;
Tell us how you have applied OpenShift in your last project.
In what cases are default @Transactional settings insufficient?
How to ensure that a Scheduled Job runs only on one instance out of 20 in a cluster?
table employee id bigint PK not null employee_name varvhar(100) not null employee_number int4 not null id; employee_name; employee_number 1000; Ivanov; 123 WITH ordered AS ( SELECT employee_number, LAG(employee_number) OVER (ORDER BY employee_number) as prev_number FROM employee ) SELECT prev_number + 1 as missing_number FROM ordered WHERE employee_number - prev_number > 1; 1000; name1; 1 1001; name2; 2 1002; name3; 4 1003; name4; 5 with ordered as () select * from ordered
List<String> getNonUnique(int[] one, int[] two) { } //one 1 3 7 5 2 //two 3 9 8 1 // result 1 3
How to implement a seat reservation system in a cinema without double sales? What type of locking to choose?
Tell me about your experience at your last job. What was your contribution?
SELECT COUNT(DISTINCT employee_number) = COUNT(*) FROM employees