0

我在 Eclipse 上添加了 commons-primitives-1.0.jar 作为外部可执行 jar。
所以我能够import org.apache.commons.collections.primitives.ArrayUnsignedShortList;

我有一个功能

private void start() {

    _nexts = new ArrayList(_iterators.size());

    for (int i = 0, m = _iterators.size(); i < m; i++) {
        _nexts.add(null);
    }
    _nextSet = new BitSet(_iterators.size());
    _prevFrom = new ArrayUnsignedShortList(); < ---give me error here
}

它说,

构造函数 ArrayUnsignedShortList() 不可见

我不太确定如何解决这个错误,因为当我查看 时ArraysUnsignedShortList.java,它确实有构造函数。

帮助?

http://commons.apache.org/proper/commons-primitives/apidocs/org/apache/commons/collections/primitives/ArrayUnsignedShortList.html

public ArrayUnsignedShortList() 构造一个具有默认初始容量的空列表。

^ 所以我应该可以调用它..

4

2 回答 2

0

它应该可以正常工作,不确定您是否拥有正确的库、正确的导入,并且没有任何东西可以干扰您的代码:

如果使用 Maven:

<dependency>
    <groupId>commons-primitives</groupId>
    <artifactId>commons-primitives</artifactId>
    <version>1.0</version>
</dependency>

进口 :

import org.apache.commons.collections.primitives.ArrayUnsignedShortList;

代码 :

ArrayUnsignedShortList myArray = new ArrayUnsignedShortList();
于 2013-04-16T04:02:54.717 回答
0

从这里下载 Jar

将 jar 导入您的项目并使用它,工作正常。

ArrayUnsignedShortList obj = new ArrayUnsignedShortList();
于 2013-04-16T04:10:30.563 回答