本文整理汇总了Java中gnu.trove.TIntHashSet.toArray方法的典型用法代码示例。如果您正苦于以下问题:Java TIntHashSet.toArray方法的具体用法?Java TIntHashSet.toArray怎么用?Java TIntHashSet.toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.TIntHashSet
的用法示例。
在下文中一共展示了TIntHashSet.toArray方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public TIntArrayList read(@NotNull DataInput dataInput) throws IOException {
TIntHashSet result = new TIntHashSet();
while (((InputStream)dataInput).available() > 0) {
int id = DataInputOutputUtil.readINT(dataInput);
if (REMOVED_MARKER == id) {
id = DataInputOutputUtil.readINT(dataInput);
result.remove(id);
}
else {
result.add(id);
}
}
return new TIntArrayList(result.toArray());
}
示例2: saveTo
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@Override
public void saveTo(DataOutput out, DataExternalizer<Value> externalizer) throws IOException {
if (needsCompacting()) {
getMergedData().saveTo(out, externalizer);
} else {
final TIntHashSet set = myInvalidated;
if (set != null && set.size() > 0) {
for (int inputId : set.toArray()) {
DataInputOutputUtil.writeINT(out, -inputId); // mark inputId as invalid, to be processed on load in ValueContainerImpl.readFrom
}
}
final ValueContainer<Value> toAppend = getAddedDelta();
if (toAppend != null && toAppend.size() > 0) {
toAppend.saveTo(out, externalizer);
}
}
}
示例3: FilteredIntIterator
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public FilteredIntIterator(IIntIterator it, TIntHashSet list, boolean listDefinesRemoved) {
_values = it;
int[] filterValues = list.toArray();
Arrays.sort(filterValues);
_filter = new IntArrayIterator(filterValues);
_remove = listDefinesRemoved;
begin();
}
示例4: getFragmentStartingLines
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public int[] getFragmentStartingLines() {
TIntHashSet beginnings = new TIntHashSet();
if (myMergeList != null) {
for (int i = 0; i < 2; i++) {
FragmentSide branchSide = FragmentSide.fromIndex(i);
beginnings.addAll(myMergeList.getChanges(branchSide).getNonAppliedLineBlocks().getBeginnings(MergeList.BASE_SIDE));
}
}
int[] result = beginnings.toArray();
Arrays.sort(result);
return result;
}
示例5: findAllTypedVarOffsets
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@NotNull
private static int[] findAllTypedVarOffsets(final PsiFile file, final Pattern[] substitutionPatterns) {
final TIntHashSet result = new TIntHashSet();
file.accept(new PsiRecursiveElementWalkingVisitor() {
@Override
public void visitElement(PsiElement element) {
super.visitElement(element);
if (element instanceof LeafElement) {
final String text = element.getText();
for (Pattern pattern : substitutionPatterns) {
final Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
result.add(element.getTextRange().getStartOffset() + matcher.end());
}
}
}
}
});
final int[] resultArray = result.toArray();
Arrays.sort(resultArray);
return resultArray;
}
示例6: get
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public int[] get(int key) {
if (mySingle.containsKey(key)) {
return new int[]{mySingle.get(key)};
}
TIntHashSet items = myMulti.get(key);
if (items == null) return ArrayUtil.EMPTY_INT_ARRAY;
return items.toArray();
}
示例7: findParametersToRemove
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@NotNull
public static TIntArrayList findParametersToRemove(@NotNull PsiMethod method,
@NotNull final PsiExpression expr,
@Nullable final PsiExpression[] occurences) {
final PsiParameter[] parameters = method.getParameterList().getParameters();
if (parameters.length == 0) return new TIntArrayList();
PsiMethod[] overridingMethods = OverridingMethodsSearch.search(method, true).toArray(PsiMethod.EMPTY_ARRAY);
final PsiMethod[] allMethods = ArrayUtil.append(overridingMethods, method);
final TIntHashSet suspects = new TIntHashSet();
expr.accept(new JavaRecursiveElementWalkingVisitor() {
@Override public void visitReferenceExpression(final PsiReferenceExpression expression) {
super.visitReferenceExpression(expression);
PsiElement resolved = expression.resolve();
if (resolved instanceof PsiParameter) {
int i = ArrayUtil.find(parameters, resolved);
if (i != -1) {
suspects.add(i);
}
}
}
});
final TIntIterator iterator = suspects.iterator();
while(iterator.hasNext()) {
final int paramNum = iterator.next();
for (PsiMethod psiMethod : allMethods) {
PsiParameter[] psiParameters = psiMethod.getParameterList().getParameters();
if (paramNum >= psiParameters.length) continue;
PsiParameter parameter = psiParameters[paramNum];
if (!ReferencesSearch.search(parameter, parameter.getResolveScope(), false).forEach(new Processor<PsiReference>() {
public boolean process(final PsiReference reference) {
PsiElement element = reference.getElement();
boolean stillCanBeRemoved = false;
if (element != null) {
stillCanBeRemoved = isAncestor(expr, element, false) || PsiUtil.isInsideJavadocComment(getPhysical(element));
if (!stillCanBeRemoved && occurences != null) {
for (PsiExpression occurence : occurences) {
if (isAncestor(occurence, element, false)) {
stillCanBeRemoved = true;
break;
}
}
}
}
if (!stillCanBeRemoved) {
iterator.remove();
return false;
}
return true;
}
})) break;
}
}
return new TIntArrayList(suspects.toArray());
}
示例8: getDefinitions
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@Nullable
public int[] getDefinitions(int varId) {
TIntHashSet set = myMap.get(varId);
return set == null ? null : set.toArray();
}