Skip to content

Conversation

@mikhail-gen
Copy link
Owner

lesson12


// Найди максимальное и минимальное число в списке с помощью Stream API.
List<Integer> nums = List.of(10, 2, 33, 4, 25);
int min = nums.get(0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

надо использовать одинаковые типы данных

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

работает autoboxing/unboxing


// Удали дубликаты и отсортируй строки по длине.
List<String> input = List.of("apple", "pear", "apple", "banana", "pear");
Set<String> unique = new HashSet<>(input);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new ArrayList<>(new HashSet<>(input));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants