为 LazyList Apache commons 找到的装饰方法

Decorate method on found for LazyList Apache commons

我在 pom.xml 中为我的 spring 启动项目导入了 apache 公共库。

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>

在模型文件中也导入了以下包。

import org.apache.commons.collections4.FactoryUtils;

这是我尝试使用 Apache io 中的 LazyList 的代码。

private List<Children> childrens = LazyList.decorate(new ArrayList<Children>(),FactoryUtils.instantiateFactory(Children.class));

我已经从 Apache commons 导入了 LazyList,但是 STS 无法从 LazyList 识别 decorate()。

请找出以下错误。

The method decorate(ArrayList<Children>, FactoryUtils.instantiateFactory(Children.class)) is undefined for the type LazyList

需要快速帮助,有人可以帮助我吗?

显然 API 在版本 3 和版本 4 之间发生了显着变化。在 v4 中你想使用方法

static <E> LazyList<E>  lazyList(List<E> list, Factory<? extends E> factory)

相反。