本文整理汇总了Java中it.unimi.dsi.fastutil.ints.IntCollection类的典型用法代码示例。如果您正苦于以下问题:Java IntCollection类的具体用法?Java IntCollection怎么用?Java IntCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntCollection类属于it.unimi.dsi.fastutil.ints包,在下文中一共展示了IntCollection类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: removeAll
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
@Override
public int[] removeAll(final ItemStack itemStack)
{
final ItemStackImplArray content = this.getArray();
if (itemStack == null)
{
return DioriteArrayUtils.EMPTY_INTS;
}
final IntCollection list = new IntArrayList(10);
for (int i = 0, size = content.length(); i < size; i++)
{
final ItemStack item = content.get(i);
if (Objects.equals(item, itemStack))
{
content.compareAndSet(i, ItemStackImpl.wrap(item), null);
list.add(i);
}
}
if (list.isEmpty())
{
return DioriteArrayUtils.EMPTY_INTS;
}
return list.toIntArray();
}
开发者ID:Diorite,项目名称:Diorite-old,代码行数:25,代码来源:InventoryImpl.java
示例2: removeAllFromEnd
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
@Override
public int[] removeAllFromEnd(final ItemStack itemStack)
{
final ItemStackImplArray content = this.getArray();
if (itemStack == null)
{
return DioriteArrayUtils.EMPTY_INTS;
}
final IntCollection list = new IntArrayList(10);
for (int i = content.length() - 1; i >= 0; i--)
{
final ItemStack item = content.get(i);
if (Objects.equals(item, itemStack))
{
content.compareAndSet(i, ItemStackImpl.wrap(item), null);
list.add(i);
}
}
if (list.isEmpty())
{
return DioriteArrayUtils.EMPTY_INTS;
}
return list.toIntArray();
}
开发者ID:Diorite,项目名称:Diorite-old,代码行数:25,代码来源:InventoryImpl.java
示例3: getWeightedRandom
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
@Nullable
public static <T> T getWeightedRandom(Random random, Object2IntMap<T> choices)
{
long i = 0;
IntCollection ints = choices.values();
for (IntIterator iterator = ints.iterator(); iterator.hasNext(); )
{
int x = iterator.nextInt();
i += x;
}
i = getRandomLong(random, 0, i);
for (Object2IntMap.Entry<T> entry : choices.object2IntEntrySet())
{
i -= entry.getIntValue();
if (i < 0)
{
return entry.getKey();
}
}
return null;
}
开发者ID:Diorite,项目名称:Diorite,代码行数:22,代码来源:DioriteRandomUtils.java
示例4: values
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
public IntCollection values() {
if ( values == null ) values = new AbstractIntCollection () {
public IntIterator iterator() {
return new ValueIterator();
}
public int size() {
return size;
}
public boolean contains( int v ) {
return containsValue( v );
}
public void clear() {
Int2IntOpenHashMap.this.clear();
}
};
return values;
}
开发者ID:kkrugler,项目名称:yalder,代码行数:18,代码来源:Int2IntOpenHashMap.java
示例5: values
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
/** Returns a type-specific-set view of the values of this map.
*
* <P>The view is backed by the set returned by {@link #entrySet()}. Note that
* <em>no attempt is made at caching the result of this method</em>, as this would
* require adding some attributes that lightweight implementations would
* not need. Subclasses may easily override this policy by calling
* this method and caching the result, but implementors are encouraged to
* write more efficient ad-hoc implementations.
*
* @return a set view of the values of this map; it may be safely cast to a type-specific interface.
*/
public IntCollection values() {
return new AbstractIntCollection () {
public boolean contains( final int k ) { return containsValue( k ); }
public int size() { return AbstractInt2IntMap.this.size(); }
public void clear() { AbstractInt2IntMap.this.clear(); }
public IntIterator iterator() {
return new AbstractIntIterator () {
final ObjectIterator<Map.Entry<Integer,Integer>> i = entrySet().iterator();
public int nextInt() { return ((Int2IntMap.Entry )i.next()).getIntValue(); };
public boolean hasNext() { return i.hasNext(); }
};
}
};
}
开发者ID:kkrugler,项目名称:yalder,代码行数:26,代码来源:AbstractInt2IntMap.java
示例6: remove
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
public void remove(T key, int value) {
IntCollection collection = map.get(key);
if (collection != null) {
collection.rem(value);
if (collection.isEmpty()) {
map.remove(key);
}
}
}
开发者ID:CodeCrafter47,项目名称:BungeeTabListPlus,代码行数:10,代码来源:Object2IntHashMultimap.java
示例7: values
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
public IntCollection values() {
return valueToKey.values();
}
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:4,代码来源:DictionaryMap.java
示例8: init
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
private int init(String graphId, URI uri) {
INameNode nameNode = new RemoteNameNode(uri);
int partCount = 0;
try {
for (URI u : nameNode.getDataNodes()) {
if (URIHelper.isLocalURI(u)) {
dataNode = DataNode.create(u);
IntCollection partitions = dataNode.getLocalPartitions(graphId);
int partId = partitions.iterator().nextInt();
// long loadS = System.currentTimeMillis();
partition = dataNode.loadLocalPartition(graphId, partId);
//StatLogger.getInstance().log("PARTITION_LOAD," + partition.getId() + "," + (System.currentTimeMillis() - loadS));
for (int pid : nameNode.getPartitionDirectory().getPartitions(graphId)) {
this.partList.add(pid);
partCount++;
}
infoPrefix = "INFO,"+partition.getId() + ",";
statePrefix = "STATE,"+partition.getId() + ",";
perfPrefix = "PERF,"+partition.getId() + ",";
break;
}
}
if (partition == null) {
throw new RuntimeException("UnExpected Error Graph " + graphId + "@" + uri +
" does not exist");
}
//long loadS = System.currentTimeMillis();
//StatLogger.getInstance().log("#SUBGRAPHS," + partition.getId() +","+ partition.size());
for (ISubgraph subgraph : partition) {
subGraphMap.put(subgraph.getId(), subgraph);
for (ITemplateVertex rv : subgraph.remoteVertices()) {
subgraphToPartitionMap.put(rv.getRemoteSubgraphId(), rv.getRemotePartitionId());
}
if (isInfoLoggingEnabled)
logInfo(new Object[]{"TOPO.SG", "SG_ID", subgraph.getId(),
"SG_V", subgraph.numVertices(), // TODO: rename subgraph.numVertices() as vertexCount()
"SG_E", subgraph.numEdges(),
"SG_RV", subgraph.numRemoteVertices()
});
}
//StatLogger.getInstance().log("#SUBGRAPHS_GOFS," + partition.getId() +","+ subGraphMap.size());
//StatLogger.getInstance().log("SUB_PART_MAP," + partition.getId() + "," +
// (System.currentTimeMillis() - loadS));
int concurrentSubGraphSlots;
if (FloeRuntimeEnvironment.getEnvironment().getSystemConfigParam(PARALLEL_WORKERS) != null) {
concurrentSubGraphSlots = Integer.parseInt(FloeRuntimeEnvironment.getEnvironment().
getSystemConfigParam(PARALLEL_WORKERS));
} else {
concurrentSubGraphSlots = (Runtime.getRuntime().availableProcessors() - 1) * 2;
}
concurrentSubGraphSlots = concurrentSubGraphSlots <= 0 ? 1 : concurrentSubGraphSlots;
pool = new ForkJoinPool(concurrentSubGraphSlots);
} catch (IOException e) {
throw new RuntimeException(e);
}
return partCount;
}
开发者ID:dream-lab,项目名称:goffish_v2,代码行数:76,代码来源:BSPProcessorPellet.java
示例9: contains
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
public boolean contains(T key, int value) {
IntCollection collection = map.get(key);
return collection != null && collection.contains(value);
}
开发者ID:CodeCrafter47,项目名称:BungeeTabListPlus,代码行数:5,代码来源:Object2IntHashMultimap.java
示例10: get
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
public IntCollection get(T key) {
return map.getOrDefault(key, IntSets.EMPTY_SET);
}
开发者ID:CodeCrafter47,项目名称:BungeeTabListPlus,代码行数:4,代码来源:Object2IntHashMultimap.java
示例11: put
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
public void put(T key, int value) {
IntCollection collection = map.computeIfAbsent(key, k -> new IntLinkedOpenHashSet(2, .75f));
collection.add(value);
}
开发者ID:CodeCrafter47,项目名称:BungeeTabListPlus,代码行数:5,代码来源:Object2IntHashMultimap.java
示例12: values
import it.unimi.dsi.fastutil.ints.IntCollection; //导入依赖的package包/类
/** Returns a set view of the values contained in this map.
* <P>Note that this specification strengthens the one given in {@link Map#values()}.
*
* @return a set view of the values contained in this map.
* @see Map#values()
*/
IntCollection values();
开发者ID:kkrugler,项目名称:yalder,代码行数:8,代码来源:Int2IntMap.java
注:本文中的it.unimi.dsi.fastutil.ints.IntCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论