![](/img/trans.png)
[英]Why can't I set a Transformer to a LazyList in 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>
已在 package 以及 model 文件中導入。
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)
反而。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.