org.openide.util.WeakSet.clear()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(277)

本文整理了Java中org.openide.util.WeakSet.clear()方法的一些代码示例,展示了WeakSet.clear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WeakSet.clear()方法的具体详情如下:
包路径:org.openide.util.WeakSet
类名称:WeakSet
方法名:clear

WeakSet.clear介绍

[英]Removes all of the elements from this set.
[中]从该集中删除所有元素。

代码示例

代码示例来源: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);
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-properties

nodesToRemove.clear();

代码示例来源:origin: senbox-org/snap-desktop

/**
 * Executes the action command.
 *
 * @return {@code Boolean.TRUE} on success, {@code Boolean.FALSE} on failure, or {@code null} on cancellation.
 */
public Boolean execute() {
  Boolean status;
  if (!productSet.isEmpty()) {
    // Case 1: If productSet is not empty, action has been constructed with selected products
    status = closeProducts(productSet);
    productSet.clear();
  } else {
    // Case 2: If productSet is empty, default constructor has been called
    status = closeProducts(getSelectedProducts());
  }
  return status;
}

相关文章