本文整理了Java中com.carrotsearch.hppc.ObjectIntHashMap.<init>()
方法的一些代码示例,展示了ObjectIntHashMap.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectIntHashMap.<init>()
方法的具体详情如下:
包路径:com.carrotsearch.hppc.ObjectIntHashMap
类名称:ObjectIntHashMap
方法名:<init>
[英]New instance with sane defaults.
[中]具有正常默认值的新实例。
代码示例来源:origin: konsoletyper/teavm
private List<Instruction> sortInstructions(Collection<Instruction> instructions, BasicBlock block) {
ObjectIntMap<Instruction> indexes = new ObjectIntHashMap<>();
int index = 0;
for (Instruction instruction : block) {
indexes.put(instruction, index++);
}
List<Instruction> sortedInstructions = new ArrayList<>(instructions);
sortedInstructions.sort(Comparator.comparing(insn -> indexes.getOrDefault(insn, -1)));
return sortedInstructions;
}
代码示例来源:origin: konsoletyper/teavm
private ObjectIntMap<Instruction> getInstructionIndexes(BasicBlock block) {
ObjectIntMap<Instruction> indexes = new ObjectIntHashMap<>();
for (Instruction instruction : block) {
indexes.put(instruction, indexes.size());
}
return indexes;
}
代码示例来源:origin: konsoletyper/teavm
private ObjectIntMap<String> generatePackageMetadata(List<ClassNode> classes, Set<String> classesRequiringName)
throws IOException {
PackageNode root = new PackageNode(null);
for (ClassNode classNode : classes) {
String className = classNode.getName();
if (!classesRequiringName.contains(className)) {
continue;
}
int dotIndex = className.lastIndexOf('.');
if (dotIndex < 0) {
continue;
}
addPackageName(root, className.substring(0, dotIndex));
}
ObjectIntMap<String> indexes = new ObjectIntHashMap<>();
writePackageStructure(root, -1, "", indexes);
writer.softNewLine();
return indexes;
}
代码示例来源:origin: konsoletyper/teavm
private void printStats(Renderer renderer, int totalSize) {
if (!Boolean.parseBoolean(System.getProperty("teavm.js.stats", "false"))) {
return;
}
System.out.println("Total output size: " + STATS_NUM_FORMAT.format(totalSize));
System.out.println("Metadata size: " + getSizeWithPercentage(renderer.getMetadataSize(), totalSize));
System.out.println("String pool size: " + getSizeWithPercentage(renderer.getStringPoolSize(), totalSize));
ObjectIntMap<String> packageSizeMap = new ObjectIntHashMap<>();
for (String className : renderer.getClassesInStats()) {
String packageName = className.substring(0, className.lastIndexOf('.') + 1);
int classSize = renderer.getClassSize(className);
packageSizeMap.put(packageName, packageSizeMap.getOrDefault(packageName, 0) + classSize);
}
String[] packageNames = packageSizeMap.keys().toArray(String.class);
Arrays.sort(packageNames, Comparator.comparing(p -> -packageSizeMap.getOrDefault(p, 0)));
for (String packageName : packageNames) {
System.out.println("Package '" + packageName + "' size: "
+ getSizeWithPercentage(packageSizeMap.get(packageName), totalSize));
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
CombinedDeletionPolicy(Logger logger, TranslogDeletionPolicy translogDeletionPolicy,
SoftDeletesPolicy softDeletesPolicy, LongSupplier globalCheckpointSupplier) {
this.logger = logger;
this.translogDeletionPolicy = translogDeletionPolicy;
this.softDeletesPolicy = softDeletesPolicy;
this.globalCheckpointSupplier = globalCheckpointSupplier;
this.snapshottedCommits = new ObjectIntHashMap<>();
}
代码示例来源:origin: carrotsearch/hppc
/**
* Creates a hash map from two index-aligned arrays of key-value pairs.
*/
public static <KType> ObjectIntHashMap<KType> from(KType[] keys, int[] values) {
if (keys.length != values.length) {
throw new IllegalArgumentException("Arrays of keys and values must have an identical length.");
}
ObjectIntHashMap<KType> map = new ObjectIntHashMap<>(keys.length);
for (int i = 0; i < keys.length; i++) {
map.put(keys[i], values[i]);
}
return map;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
public ObjectIntHashMap<String> nodesPerAttributesCounts(String attributeName) {
ObjectIntHashMap<String> nodesPerAttributesCounts = nodesPerAttributeNames.get(attributeName);
if (nodesPerAttributesCounts != null) {
return nodesPerAttributesCounts;
}
nodesPerAttributesCounts = new ObjectIntHashMap<>();
for (RoutingNode routingNode : this) {
String attrValue = routingNode.node().getAttributes().get(attributeName);
nodesPerAttributesCounts.addTo(attrValue, 1);
}
nodesPerAttributeNames.put(attributeName, nodesPerAttributesCounts);
return nodesPerAttributesCounts;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
CombinedDeletionPolicy(Logger logger, TranslogDeletionPolicy translogDeletionPolicy,
SoftDeletesPolicy softDeletesPolicy, LongSupplier globalCheckpointSupplier) {
this.logger = logger;
this.translogDeletionPolicy = translogDeletionPolicy;
this.softDeletesPolicy = softDeletesPolicy;
this.globalCheckpointSupplier = globalCheckpointSupplier;
this.snapshottedCommits = new ObjectIntHashMap<>();
}
代码示例来源:origin: harbby/presto-connectors
JvmStats() {
versions = new ObjectIntHashMap<>();
threads = 0;
maxUptime = 0;
heapMax = 0;
heapUsed = 0;
}
代码示例来源:origin: apache/servicemix-bundles
CombinedDeletionPolicy(Logger logger, TranslogDeletionPolicy translogDeletionPolicy, LongSupplier globalCheckpointSupplier) {
this.logger = logger;
this.translogDeletionPolicy = translogDeletionPolicy;
this.globalCheckpointSupplier = globalCheckpointSupplier;
this.snapshottedCommits = new ObjectIntHashMap<>();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
this.versions = new ObjectIntHashMap<>();
long threads = 0;
long maxUptime = 0;
代码示例来源:origin: org.elasticsearch/elasticsearch
this.names = new ObjectIntHashMap<>();
this.prettyNames = new ObjectIntHashMap<>();
int availableProcessors = 0;
int allocatedProcessors = 0;
代码示例来源:origin: org.elasticsearch/elasticsearch
ObjectIntHashMap<String> shardPerAttribute = new ObjectIntHashMap<>();
for (ShardRouting assignedShard : allocation.routingNodes().assignedShards(shardRouting.shardId())) {
if (assignedShard.started() || assignedShard.initializing()) {
代码示例来源:origin: clir/clearnlp
@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
List<ObjectIntPair<T>> list = (List<ObjectIntPair<T>>)in.readObject();
g_map = new com.carrotsearch.hppc.ObjectIntHashMap<T>(list.size());
put(list);
}
代码示例来源:origin: mikvor/hashmapTest
@Override
public void setup(int[] keys, float fillFactor, final int oneFailureOutOf ) {
super.setup(keys, fillFactor, oneFailureOutOf);
m_map = new ObjectIntHashMap<>( keys.length, fillFactor );
for ( Integer key : keys ) m_map.put( new Integer( key % oneFailureOutOf == 0 ? key+1 : key), key );
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
public ObjectIntHashMap<String> nodesPerAttributesCounts(String attributeName) {
ObjectIntHashMap<String> nodesPerAttributesCounts = nodesPerAttributeNames.get(attributeName);
if (nodesPerAttributesCounts != null) {
return nodesPerAttributesCounts;
}
nodesPerAttributesCounts = new ObjectIntHashMap<>();
for (RoutingNode routingNode : this) {
String attrValue = routingNode.node().getAttributes().get(attributeName);
nodesPerAttributesCounts.addTo(attrValue, 1);
}
nodesPerAttributeNames.put(attributeName, nodesPerAttributesCounts);
return nodesPerAttributesCounts;
}
代码示例来源:origin: mikvor/hashmapTest
@Override
public int test() {
final ObjectIntHashMap<Integer> m_map = new ObjectIntHashMap<>( m_keys.length, m_fillFactor );
for ( int i = 0; i < m_keys.length; ++i )
m_map.put( m_keys[ i ], i );
for ( int i = 0; i < m_keys2.length; ++i )
m_map.put( m_keys2[ i ], i );
return m_map.size();
}
}
代码示例来源:origin: net.sourceforge.teetime/teetime
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public void check() {
int color = DEFAULT_COLOR;
ObjectIntMap<AbstractStage> colors = new ObjectIntHashMap<AbstractStage>();
ThreadPainter threadPainter = new ThreadPainter();
Traverser traverser = new Traverser(threadPainter);
for (AbstractStage threadableStage : threadableStages) {
color++;
colors.put(threadableStage, color);
threadPainter.reset(colors, color, threadableStages);
traverser.traverse(threadableStage);
}
}
代码示例来源:origin: net.sourceforge.teetime/teetime
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public void check() {
int color = DEFAULT_COLOR;
ObjectIntMap<AbstractStage> colors = new ObjectIntHashMap<AbstractStage>();
ThreadPainter threadPainter = new ThreadPainter();
Traverser traverser = new Traverser(threadPainter);
for (AbstractStage threadableStage : threadableStages) {
color++;
colors.put(threadableStage, color);
threadPainter.reset(colors, color, threadableStages);
traverser.traverse(threadableStage);
}
}
代码示例来源:origin: harbby/presto-connectors
@Override
public void readFrom(StreamInput in) throws IOException {
int size = in.readVInt();
versions = new ObjectIntHashMap<>(size);
for (; size > 0; size--) {
versions.addTo(JvmVersion.readJvmVersion(in), in.readVInt());
}
threads = in.readVLong();
maxUptime = in.readVLong();
heapUsed = in.readVLong();
heapMax = in.readVLong();
}
内容来源于网络,如有侵权,请联系作者删除!