简体   繁体   中英

Decorate method on found for LazyList Apache commons

I have imported apache commons lib for my spring boot project in pom.xml.

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

Have imported below package as well in model file.

import org.apache.commons.collections4.FactoryUtils;

Here is the code where I am trying to use LazyList from Apache io.

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

I have imported LazyList from Apache commons, But STS is not able to recognize decorate() from LazyList.

Please find below error.

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

Need quick help can someone please assist me?

Apparently the API has changed significantly between version 3 and version 4. In v4 you want to use the method

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

instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM