本文整理了Java中org.openide.util.WeakSet.resize()
方法的一些代码示例,展示了WeakSet.resize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WeakSet.resize()
方法的具体详情如下:
包路径:org.openide.util.WeakSet
类名称:WeakSet
方法名:resize
[英]compact set if it is empty by setting new capacity
[中]通过设置新容量来压缩空集
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-apt
@Override
public final void dispose() {
if (CndTraceFlags.TRACE_SLICE_DISTIBUTIONS) {
Object[] arr = storage.toArray();
System.out.println("Dispose macro cache "+arr.length + " " + getClass().getName()); // NOI18N
Map<Class<?>, Integer> classes = new HashMap<Class<?>,Integer>();
for(Object o : arr){
if (o != null) {
Integer i = classes.get(o.getClass());
if (i != null) {
i = Integer.valueOf(i.intValue() + 1);
} else {
i = Integer.valueOf(1);
}
classes.put(o.getClass(), i);
}
}
for(Map.Entry<Class<?>,Integer> e:classes.entrySet()){
System.out.println(" "+e.getValue()+" of "+e.getKey().getName()); // NOI18N
}
}
if (storage.size() > 0) {
storage.clear();
storage.resize(initialCapacity);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-apt
@Override
public final void dispose() {
if (CndTraceFlags.TRACE_SLICE_DISTIBUTIONS) {
Object[] arr = storage.toArray();
System.out.println("Dispose macro cache "+arr.length + " " + getClass().getName()); // NOI18N
Map<Class<?>, Integer> classes = new HashMap<Class<?>,Integer>();
for(Object o : arr){
if (o != null) {
Integer i = classes.get(o.getClass());
if (i != null) {
i = Integer.valueOf(i.intValue() + 1);
} else {
i = Integer.valueOf(1);
}
classes.put(o.getClass(), i);
}
}
for(Map.Entry<Class<?>,Integer> e:classes.entrySet()){
System.out.println(" "+e.getValue()+" of "+e.getKey().getName()); // NOI18N
}
}
if (storage.size() > 0) {
storage.clear();
storage.resize(initialCapacity);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils
@Override
public final void dispose() {
if (CndTraceFlags.TRACE_SLICE_DISTIBUTIONS){
Object[] arr;
synchronized (lock) {
arr = storage.toArray();
}
System.out.println("Dispose cache "+name+" "+arr.length + " " + getClass().getName()); // NOI18N
Map<Class, Integer> classes = new HashMap<Class,Integer>();
for(Object o : arr){
if (o != null) {
Integer i = classes.get(o.getClass());
if (i != null) {
i = Integer.valueOf(i.intValue() + 1);
} else {
i = Integer.valueOf(1);
}
classes.put(o.getClass(), i);
}
}
for(Map.Entry<Class,Integer> e:classes.entrySet()){
System.out.println(" "+e.getValue()+" of "+e.getKey().getName()); // NOI18N
}
}
if (storage.size() > 0) {
storage.clear();
storage.resize(initialCapacity);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl
public final void dispose() {
for (int i = 0; i < instances.length; i++) {
if (instances[i].size() > 0) {
if (CndTraceFlags.TRACE_SLICE_DISTIBUTIONS) {
Object[] arr = instances[i].toArray();
System.out.println("Key cache " + instances[i].size()); // NOI18N
Map<Class, Integer> classes = new HashMap<>();
for (Object o : arr) {
if (o != null) {
Integer num = classes.get(o.getClass());
if (num != null) {
num = new Integer(num.intValue() + 1);
} else {
num = new Integer(1);
}
classes.put(o.getClass(), num);
}
}
for (Map.Entry<Class, Integer> e : classes.entrySet()) {
System.out.println(" " + e.getValue() + " of " + e.getKey().getName()); // NOI18N
}
}
instances[i].clear();
instances[i].resize(initialCapacity);
}
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl
private void dispose() {
for (int i = 0; i < instances.length; i++) {
if (instances[i].size() > 0) {
if (CndTraceFlags.TRACE_SLICE_DISTIBUTIONS) {
Object[] arr = instances[i].toArray();
System.out.println("Dispose UID cache " + instances[i].size()); // NOI18N
Map<Class, Integer> uidClasses = new HashMap<>();
Map<Class, Integer> keyClasses = new HashMap<>();
for (Object o : arr) {
if (o != null) {
incCounter( uidClasses, o);
if (o instanceof KeyBasedUID<?>) {
Key k = ((KeyBasedUID<?>)o).getKey();
incCounter( keyClasses, k);
}
}
}
for (Map.Entry<Class, Integer> e : uidClasses.entrySet()) {
System.out.println(" " + e.getValue() + " of " + e.getKey().getName()); // NOI18N
}
System.out.println("-----------"); // NOI18N
for (Map.Entry<Class, Integer> e : keyClasses.entrySet()) {
System.out.println(" " + e.getValue() + " of " + e.getKey().getName()); // NOI18N
}
}
instances[i].clear();
instances[i].resize(initialCapacity);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!