java.util.WeakHashMap.entrySet()方法的使用及代码示例

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

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

WeakHashMap.entrySet介绍

[英]Returns a set containing all of the mappings in this map. Each mapping is an instance of Map.Entry. As the set is backed by this map, changes in one will be reflected in the other. It does not support adding operations.
[中]返回包含此映射中所有映射的集。每个映射都是Map的一个实例。进入由于布景以这张地图为背景,其中一张地图上的变化将反映在另一张地图上。它不支持添加操作。

代码示例

代码示例来源:origin: apache/incubator-gobblin

public synchronized List<L> getListeners() {
 // Clone to protect against adding/removing listeners while running callbacks
 ArrayList<L> res = new ArrayList<>(_listeners);
 // Scan any auto listeners
 for (Map.Entry<L, Void> entry: _autoListeners.entrySet()) {
  res.add(entry.getKey());
 }
 return res;
}

代码示例来源:origin: aa112901/remusic

public static void clearTintCache() {
  for (Map.Entry<Context, TintManager> entry : INSTANCE_CACHE.entrySet()) {
    TintManager tm = entry.getValue();
    if (tm != null)
      tm.clear();
  }
  COLOR_FILTER_CACHE.evictAll();
}

代码示例来源:origin: yahoo/squidb

private void markAcquiredConnectionsLocked(AcquiredConnectionStatus status) {
  if (!mAcquiredConnections.isEmpty()) {
    ArrayList<SQLiteConnection> keysToUpdate = new ArrayList<SQLiteConnection>(
        mAcquiredConnections.size());
    for (Map.Entry<SQLiteConnection, AcquiredConnectionStatus> entry
        : mAcquiredConnections.entrySet()) {
      AcquiredConnectionStatus oldStatus = entry.getValue();
      if (status != oldStatus
          && oldStatus != AcquiredConnectionStatus.DISCARD) {
        keysToUpdate.add(entry.getKey());
      }
    }
    final int updateCount = keysToUpdate.size();
    for (int i = 0; i < updateCount; i++) {
      mAcquiredConnections.put(keysToUpdate.get(i), status);
    }
  }
}

代码示例来源:origin: grandcentrix/tray

@Override
  public void onChange(final boolean selfChange, Uri uri) {
    if (uri == null) {
      // for sdk version 15 and below we cannot detect which exact data was changed. This will
      // return all data for this module
      uri = mTrayUri.builder().setModule(getModuleName()).build();
    }
    // query only the changed items
    final List<TrayItem> trayItems = mProviderHelper.queryProviderSafe(uri);
    // clone to get around ConcurrentModificationException
    final Set<Map.Entry<OnTrayPreferenceChangeListener, Handler>> entries
        = new HashSet<>(mListeners.entrySet());
    // notify all registered listeners
    for (final Map.Entry<OnTrayPreferenceChangeListener, Handler> entry : entries) {
      final OnTrayPreferenceChangeListener listener = entry.getKey();
      final Handler handler = entry.getValue();
      if (handler != null) {
        // call the listener on the thread where the listener was registered
        handler.post(new Runnable() {
          @Override
          public void run() {
            listener.onTrayPreferenceChanged(trayItems);
          }
        });
      } else {
        listener.onTrayPreferenceChanged(trayItems);
      }
    }
  }
}

代码示例来源:origin: yahoo/squidb

if (!mAcquiredConnections.isEmpty()) {
  for (Map.Entry<SQLiteConnection, AcquiredConnectionStatus> entry :
      mAcquiredConnections.entrySet()) {
    final SQLiteConnection connection = entry.getKey();
    connection.dumpUnsafe(indentedPrinter, verbose);

代码示例来源:origin: multidots/android-app-common-tasks

/**
 * A debugging routine.
 */
public synchronized void dump() {
  for (Map.Entry<Thread, ThreadStatus> entry : mThreadStatus.entrySet()) {
    Log.v(TAG, "[Dump] Thread " + entry.getKey() + " ("
        + entry.getKey().getId()
        + ")'s status is " + entry.getValue());
  }
}

代码示例来源:origin: multidots/android-app-common-tasks

/**
 * A debugging routine.
 */
public synchronized void dump() {
  for (Map.Entry<Thread, ThreadStatus> entry : mThreadStatus.entrySet()) {
    Log.v(TAG, "[Dump] Thread " + entry.getKey() + " ("
        + entry.getKey().getId()
        + ")'s status is " + entry.getValue());
  }
}

代码示例来源:origin: yahoo/squidb

private void markAcquiredConnectionsLocked(AcquiredConnectionStatus status) {
  if (!mAcquiredConnections.isEmpty()) {
    ArrayList<SQLiteConnection> keysToUpdate = new ArrayList<SQLiteConnection>(
        mAcquiredConnections.size());
    for (Map.Entry<SQLiteConnection, AcquiredConnectionStatus> entry
        : mAcquiredConnections.entrySet()) {
      AcquiredConnectionStatus oldStatus = entry.getValue();
      if (status != oldStatus
          && oldStatus != AcquiredConnectionStatus.DISCARD) {
        keysToUpdate.add(entry.getKey());
      }
    }
    final int updateCount = keysToUpdate.size();
    for (int i = 0; i < updateCount; i++) {
      mAcquiredConnections.put(keysToUpdate.get(i), status);
    }
  }
}

代码示例来源:origin: typ0520/fastdex

static List<Activity> getAllActivities() {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    ArrayList<Activity> list = new ArrayList<>();
    for (Map.Entry<Activity, Integer> e : sActivitiesRefs.entrySet()) {
      Activity a = e.getKey();
      if (a != null && e.getValue().intValue() > 0) {
        list.add(a);
      }
    }
    return list;
  }
  else {
    return getActivities(Fastdex.get().getApplicationContext(),true);
  }
}

代码示例来源:origin: typ0520/fastdex

static Activity getTopActivity() {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    Activity r = null;
    for (Map.Entry<Activity, Integer> e : sActivitiesRefs.entrySet()) {
      Activity a = e.getKey();
      if (a != null && e.getValue().intValue() == ACTIVITY_RESUMED) {
        r = a;
      }
    }
    return r;
  }
  else {
    return getForegroundActivity(Fastdex.get().getApplicationContext());
  }
}

代码示例来源:origin: com.github.nyla-solutions/nyla.solutions.core

/**
 * @return set of entries
 * @see java.util.Hashtable#entrySet()
 */
public Set<Entry<K,V>> entrySet()
{
  return map.entrySet();
}// --------------------------------------------------------

代码示例来源:origin: org.zkoss.zk/zkbind

private Set<Entry<Object, EqualBeans>> entrySet() {
    return _innerMap.entrySet();
  }
}

代码示例来源:origin: org.apache.gobblin/gobblin-utility

public synchronized List<L> getListeners() {
 // Clone to protect against adding/removing listeners while running callbacks
 ArrayList<L> res = new ArrayList<>(_listeners);
 // Scan any auto listeners
 for (Map.Entry<L, Void> entry: _autoListeners.entrySet()) {
  res.add(entry.getKey());
 }
 return res;
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-utility

public synchronized List<L> getListeners() {
 // Clone to protect against adding/removing listeners while running callbacks
 ArrayList<L> res = new ArrayList<>(_listeners);
 // Scan any auto listeners
 for (Map.Entry<L, Void> entry: _autoListeners.entrySet()) {
  res.add(entry.getKey());
 }
 return res;
}

代码示例来源:origin: de.mhus.lib/mhu-lib-core

@Override
public String[] getEntries() {
  LinkedList<String> out = new LinkedList<String>();
  for (Map.Entry<?, ?> item : map.entrySet()) {
    out.add(item.getKey() + "=" + item.getValue());
  }
  return out.toArray(new String[out.size()]);
}

代码示例来源:origin: gpfduoduo/AirPlay-Receiver-on-Android

/**
 * A debugging routine.
 */
public synchronized void dump() {
  Iterator<Map.Entry<Thread, ThreadStatus>> i =
      mThreadStatus.entrySet().iterator();
  while (i.hasNext()) {
    Map.Entry<Thread, ThreadStatus> entry = i.next();
    Log.v(TAG, "[Dump] Thread " + entry.getKey() + " ("
        + entry.getKey().getId()
        + ")'s status is " + entry.getValue());
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public void dump(Appendable out, String indent) throws IOException
{
  AggregateLifeCycle.dumpObject(out,this);
  AggregateLifeCycle.dump(out, indent, _beans.entrySet());
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

@Override
public void dump(Appendable out, String indent) throws IOException
{
  ContainerLifeCycle.dumpObject(out,this);
  ContainerLifeCycle.dump(out, indent, _beans.entrySet());
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

@Override
public void dump(Appendable out, String indent) throws IOException
{
  ContainerLifeCycle.dumpObject(out,this);
  ContainerLifeCycle.dump(out, indent, _beans.entrySet());
}

代码示例来源:origin: jboss-fuse/fabric8

@Override
public void dump(Appendable out, String indent) throws IOException
{
  ContainerLifeCycle.dumpObject(out,this);
  ContainerLifeCycle.dump(out, indent, _beans.entrySet());
}

相关文章