Module javafx.base

Class FilteredList<E>

    • Property Detail

      • predicate

        public final ObjectProperty<Predicate<? super E>> predicateProperty
        The predicate that will match the elements that will be in this FilteredList. Elements not matching the predicate will be filtered-out. Null predicate means "always true" predicate, all elements will be matched.
        See Also:
        getPredicate(), setPredicate(Predicate)
    • Constructor Detail

      • FilteredList

        public FilteredList​(ObservableList<E> source,
                            Predicate<? super E> predicate)
        Constructs a new FilteredList wrapper around the source list. The provided predicate will match the elements in the source list that will be visible. If the predicate is null, all elements will be matched and the list is equal to the source list.
        Parameters:
        source - the source list
        predicate - the predicate to match the elements or null to match all elements.
      • FilteredList

        public FilteredList​(ObservableList<E> source)
        Constructs a new FilteredList wrapper around the source list. This list has an "always true" predicate, containing all the elements of the source list.

        This constructor might be useful if you want to bind predicateProperty() of this list.

        Parameters:
        source - the source list
    • Method Detail

      • predicateProperty

        public final ObjectProperty<Predicate<? super E>> predicateProperty()
        The predicate that will match the elements that will be in this FilteredList. Elements not matching the predicate will be filtered-out. Null predicate means "always true" predicate, all elements will be matched.
        See Also:
        getPredicate(), setPredicate(Predicate)
      • getPredicate

        public final Predicate<? super E> getPredicate()
        Gets the value of the property predicate.
        Property description:
        The predicate that will match the elements that will be in this FilteredList. Elements not matching the predicate will be filtered-out. Null predicate means "always true" predicate, all elements will be matched.
      • setPredicate

        public final void setPredicate​(Predicate<? super E> predicate)
        Sets the value of the property predicate.
        Property description:
        The predicate that will match the elements that will be in this FilteredList. Elements not matching the predicate will be filtered-out. Null predicate means "always true" predicate, all elements will be matched.
      • size

        public int size()
        Returns the number of elements in this list.
        Specified by:
        size in interface Collection<E>
        Specified by:
        size in interface List<E>
        Specified by:
        size in class AbstractCollection<E>
        Returns:
        the number of elements in this list
      • get

        public E get​(int index)
        Returns the element at the specified position in this list.
        Specified by:
        get in interface List<E>
        Specified by:
        get in class AbstractList<E>
        Parameters:
        index - index of the element to return
        Returns:
        the element at the specified position in this list
        Throws:
        IndexOutOfBoundsException