Если вам нужно написать Comparator для сортировки объектов по возрастанию, обычно он выглядит так:
public class ByScoreComparator implements Comparator<User> {
@Override public int compare(User u1, User u2) { return (int) signum(u2.getAge() - u1.getAge()); } }
➡️Главная проблема — понять, от чего отнимать, чтобы порядок был правильным. Правильный ответ с первого раза получается редко, и часто мы замечаем ошибку уже после запуска кода.
Теперь это не нужно. Можно использовать ссылки на методы:
Если вам нужно написать Comparator для сортировки объектов по возрастанию, обычно он выглядит так:
public class ByScoreComparator implements Comparator<User> {
@Override public int compare(User u1, User u2) { return (int) signum(u2.getAge() - u1.getAge()); } }
➡️Главная проблема — понять, от чего отнимать, чтобы порядок был правильным. Правильный ответ с первого раза получается редко, и часто мы замечаем ошибку уже после запуска кода.
Теперь это не нужно. Можно использовать ссылки на методы:
Telegram hopes to raise $1bn with a convertible bond private placement
The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.
Newly uncovered hack campaign in Telegram
The campaign, which security firm Check Point has named Rampant Kitten, comprises two main components, one for Windows and the other for Android. Rampant Kitten’s objective is to steal Telegram messages, passwords, and two-factor authentication codes sent by SMS and then also take screenshots and record sounds within earshot of an infected phone, the researchers said in a post published on Friday.