本文整理匯總了Java中com.intellij.openapi.util.Key.getKeyByIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java Key.getKeyByIndex方法的具體用法?Java Key.getKeyByIndex怎麽用?Java Key.getKeyByIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.util.Key
的用法示例。
在下文中一共展示了Key.getKeyByIndex方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: minus
import com.intellij.openapi.util.Key; //導入方法依賴的package包/類
@NotNull
@Override
public KeyFMap minus(@NotNull Key<?> key) {
int oldSize = size();
int keyCode = key.hashCode();
for (int i = 0; i< oldSize; i++) {
int oldKey = keys[i];
if (keyCode == oldKey) {
if (oldSize == 3) {
int i1 = (2-i)/2;
int i2 = 3 - (i+2)/2;
Key<Object> key1 = Key.getKeyByIndex(keys[i1]);
Key<Object> key2 = Key.getKeyByIndex(keys[i2]);
if (key1 == null && key2 == null) return EMPTY_MAP;
if (key1 == null) return new OneElementFMap<Object>(key2, values[i2]);
if (key2 == null) return new OneElementFMap<Object>(key1, values[i1]);
return new PairElementsFMap(key1, values[i1], key2, values[i2]);
}
int[] newKeys = ArrayUtil.remove(keys, i);
Object[] newValues = ArrayUtil.remove(values, i, ArrayUtil.OBJECT_ARRAY_FACTORY);
return new ArrayBackedFMap(newKeys, newValues);
}
}
return this;
}
示例2: toString
import com.intellij.openapi.util.Key; //導入方法依賴的package包/類
@Override
public String toString() {
String s = "";
for (int i = 0; i < keys.length; i++) {
int key = keys[i];
Object value = values[i];
s += (s.isEmpty() ? "" : ", ") + Key.getKeyByIndex(key) + " -> " + value;
}
return "(" + s + ")";
}
示例3: getKeysByIndices
import com.intellij.openapi.util.Key; //導入方法依賴的package包/類
@NotNull
static Key[] getKeysByIndices(int[] indexes) {
Key[] result = new Key[indexes.length];
for (int i =0; i < indexes.length; i++) {
result[i] = Key.getKeyByIndex(indexes[i]);
}
return result;
}