本文整理了Java中java.util.WeakHashMap.size()
方法的一些代码示例,展示了WeakHashMap.size()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WeakHashMap.size()
方法的具体详情如下:
包路径:java.util.WeakHashMap
类名称:WeakHashMap
方法名:size
[英]The number of key-value mappings contained in this weak hash map.
[中]此弱哈希映射中包含的键值映射数。
代码示例来源:origin: medcl/elasticsearch-analysis-ik
static int markersSize() {
return markers.size();
}
代码示例来源:origin: redisson/redisson
public static int getInvalidMapSize() { return invalidNamesMap.size(); }
代码示例来源:origin: robovm/robovm
/**
* Returns the number of elements in this map.
*
* @return the number of elements in this map.
*/
@Override
public boolean isEmpty() {
return size() == 0;
}
代码示例来源:origin: robovm/robovm
@Override
public int size() {
return WeakHashMap.this.size();
}
代码示例来源:origin: robovm/robovm
@Override
public int size() {
return WeakHashMap.this.size();
}
代码示例来源:origin: com.google.protobuf/protobuf-java
int getUnknownEnumValueDescriptorCount() {
return unknownValues.size();
}
代码示例来源:origin: scouter-project/scouter
public static int getInvalidMapSize() { return invalidNamesMap.size(); }
代码示例来源: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: stackoverflow.com
if (map.size() != 0) {
System.out.println("At iteration " + i + " the map still holds the reference on someDataObject");
} else {
代码示例来源:origin: grandcentrix/tray
public void unregisterOnTrayPreferenceChangeListener(
@NonNull final OnTrayPreferenceChangeListener listener) {
// noinspection ConstantConditions
if (listener == null) {
return;
}
mListeners.remove(listener);
if (mListeners.size() == 0) {
mContext.getContentResolver().unregisterContentObserver(mObserver);
// cleanup
mObserver = null;
mObserverThread.quit();
mObserverThread = null;
}
}
代码示例来源:origin: commons-httpclient/commons-httpclient
ALL_CONNECTION_MANAGERS.keySet().toArray(
new MultiThreadedHttpConnectionManager
[ALL_CONNECTION_MANAGERS.size()]
);
代码示例来源:origin: yahoo/squidb
int openConnections = mAcquiredConnections.size();
if (mAvailablePrimaryConnection != null) {
openConnections += 1;
代码示例来源:origin: grandcentrix/tray
public void testUnregister() throws Exception {
final OnTrayPreferenceChangeListener listener = new OnTrayPreferenceChangeListener() {
@Override
public void onTrayPreferenceChanged(final Collection<TrayItem> items) {
}
};
final ContentProviderStorage userStorage = checkChangeListener(true, listener);
assertEquals(1, userStorage.mListeners.size());
// unregister null should do nothing
userStorage.unregisterOnTrayPreferenceChangeListener(null);
assertEquals(1, userStorage.mListeners.size());
userStorage.unregisterOnTrayPreferenceChangeListener(listener);
assertEquals(0, userStorage.mListeners.size());
assertNull(userStorage.mObserver);
assertNull(userStorage.mObserverThread);
}
代码示例来源:origin: yahoo/squidb
private void dispose(boolean finalized) {
if (mCloseGuard != null) {
if (finalized) {
mCloseGuard.warnIfOpen();
}
mCloseGuard.close();
}
if (!finalized) {
// Close all connections. We don't need (or want) to do this
// when finalized because we don't know what state the connections
// themselves will be in. The finalizer is really just here for CloseGuard.
// The connections will take care of themselves when their own finalizers run.
synchronized (mLock) {
throwIfClosedLocked();
mIsOpen = false;
closeAvailableConnectionsAndLogExceptionsLocked();
final int pendingCount = mAcquiredConnections.size();
if (pendingCount != 0) {
Logger.i(TAG, "The connection pool for " + mConfiguration.label
+ " has been closed but there are still "
+ pendingCount + " connections in use. They will be closed "
+ "as they are released back to the pool.");
}
wakeConnectionWaitersLocked();
}
}
}
代码示例来源:origin: grandcentrix/tray
public void testRegisterNull() throws Exception {
final ContentProviderStorage storage = new ContentProviderStorage(
getProviderMockContext(), "testRegisterNull", TrayStorage.Type.USER);
storage.registerOnTrayPreferenceChangeListener(null);
assertEquals(0, storage.mListeners.size());
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Return the size of the cached markers. This size can vary as markers are cached but collected during GC activity when a given prefix
* is no longer in use.
*
* @return the size of the cached markers
*/
static int markersSize() {
return markers.size();
}
代码示例来源:origin: EsotericSoftware/reflectasm
static public int activeAccessClassLoaders () {
int sz = accessClassLoaders.size();
if (selfContextAccessClassLoader != null) sz++;
return sz;
}
}
代码示例来源:origin: square/gifencoder
/**
* Get the ID of an object, adding it to the ID map if it isn't already registered.
*/
private static int getObjectId(Object object) {
synchronized (objectIds) {
Integer id = objectIds.get(object);
if (id == null) {
id = objectIds.size();
objectIds.put(object, id);
}
return id;
}
}
}
代码示例来源: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: yahoo/squidb
private void dispose(boolean finalized) {
if (mCloseGuard != null) {
if (finalized) {
mCloseGuard.warnIfOpen();
}
mCloseGuard.close();
}
if (!finalized) {
// Close all connections. We don't need (or want) to do this
// when finalized because we don't know what state the connections
// themselves will be in. The finalizer is really just here for CloseGuard.
// The connections will take care of themselves when their own finalizers run.
synchronized (mLock) {
throwIfClosedLocked();
mIsOpen = false;
closeAvailableConnectionsAndLogExceptionsLocked();
final int pendingCount = mAcquiredConnections.size();
if (pendingCount != 0) {
Log.i(TAG, "The connection pool for " + mConfiguration.label
+ " has been closed but there are still "
+ pendingCount + " connections in use. They will be closed "
+ "as they are released back to the pool.");
}
wakeConnectionWaitersLocked();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!