9 Temmuz 2019 Salı

Collections2 Sınıfı

filter metodu
İmzası şöyle.
Collection<E> filter(Collection<E> collection, Predicate<? super E> predicate);
Açıklaması şöyle. Iterators.filter() metoduna benzer. Girdi olarak Collection alır, çıktı olarak Collection döner.
A few things to note here – first, the output of Collections.filter() is a live view of the original collection – changes to one will be reflected in the other.

It’s also important to understand that now, the result is constrained by the predicate – if we add an element that doesn’t satisfy that Predicate, an IllegalArgumentException will be thrown:
Örnek
Şöyle yaparız.
Collection2.filter(collection, () -> ...)

Hiç yorum yok:

Yorum Gönder