The method toList() is undefined for the type Stream

The method toList() is undefined for the type Stream   (JDK16)

    default List<T> toList() {
        return (List<T>) Collections.unmodifiableList(new ArrayList<>(Arrays.asList(this.toArray())));
    }