预先感谢您,非常感谢!我正在尝试使用 apache commons MultiValuedMap 实现。但是,我似乎无法导入正确的包???这是我的进口:package com.ge.digital.fleet.dataservice.impl.db;import java.util.Arrays;import java.util.Map;import java.util.ArrayList;import java.util.Collection;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import java.util.Set;import org.apache.commons.collections4.MultiValuedMap;import org.apache.commons.collections4.MultiValuedMap.ArrayListValuedHashMap;//import org.apache.commons.collections4.map.MultiValueMap;import com.ge.digital.fleet.dataservice.RefDataServiceInvalidDataException;import com.ge.digital.fleet.dataservice.RefDataServiceUnavailableException;public class RefDatabase { private static final Logger log = LoggerFactory.getLogger(RefDatabase.class); private MultiValuedMap<String, String> associationsMap = new ArrayListValuedHashMap<>();// private Map<String,Collection<String>> map = associationsMap.asMap();我的 POM.xml 具有公共依赖项 <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> <version>4.1</version> </dependency>但它会引发编译错误[ERROR] C:\Users\212555427\devel\workspaces\jbds\iprcsmartsignal\fleet-predix-new\fleet.mt1.dataserviceimpl\src\main\java\com\ge\digital\fleet\dataservice\impl\db\RefDatabase.java:[11,53] error: cannot find symbol[ERROR] symbol: class ArrayListValuedHashMap[ERROR] location: interface MultiValuedMap[ERROR] C:\Users\212555427\devel\workspaces\jbds\iprcsmartsignal\fleet-predix-new\fleet.mt1.dataserviceimpl\src\main\java\com\ge\digital\fleet\dataservice\impl\db\RefDatabase.java:[21,62] error: cannot find symbol[ERROR] symbol: class ArrayListValuedHashMap[ERROR] location: class RefDatabase我尝试了几种导入组合,但没有成功。谢谢你!!!
1 回答
慕运维8079593
TA贡献1876条经验 获得超5个赞
看来这个组合有效,我不确定这是否正确?
import org.apache.commons.collections4.MultiValuedMap;
//import org.apache.commons.collections4.MultiValuedMap.ArrayListValuedHashMap;
//import org.apache.commons.collections4.map.MultiValueMap;
import org.apache.commons.collections4.multimap.*;
//import org.apache.commons.collections4.*;
//import org.apache.commons.collections4.MultiValuedMap.*;
//import org.apache.commons.collections4.map.*;
添加回答
举报
0/150
提交
取消