java.util.LinkedHashMap.isEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(188)

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

LinkedHashMap.isEmpty介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public boolean isEmpty() {
  return this.targetMap.isEmpty();
}

代码示例来源:origin: org.springframework/spring-core

@Override
public boolean isEmpty() {
  return this.targetMap.isEmpty();
}

代码示例来源:origin: spring-projects/spring-security

/**
 * Allows determining if a mapping was added.
 *
 * <p>
 * This is not exposed so as not to confuse users of the API, which should never need
 * to invoke this method.
 * </p>
 *
 * @return true if a mapping was added, else false
 */
protected boolean containsMapping() {
  return !this.matcherToExpression.isEmpty();
}

代码示例来源:origin: jeasonlzy/okhttp-OkGo

public void put(HttpHeaders headers) {
  if (headers != null) {
    if (headers.headersMap != null && !headers.headersMap.isEmpty()) headersMap.putAll(headers.headersMap);
  }
}

代码示例来源:origin: jeasonlzy/okhttp-OkGo

public void put(HttpParams params) {
  if (params != null) {
    if (params.urlParamsMap != null && !params.urlParamsMap.isEmpty()) urlParamsMap.putAll(params.urlParamsMap);
    if (params.fileParamsMap != null && !params.fileParamsMap.isEmpty()) fileParamsMap.putAll(params.fileParamsMap);
  }
}

代码示例来源:origin: apache/kafka

void completeDelayedChannelClose(long currentTimeNanos) {
  if (delayedClosingChannels == null)
    return;
  while (!delayedClosingChannels.isEmpty()) {
    DelayedAuthenticationFailureClose delayedClose = delayedClosingChannels.values().iterator().next();
    if (!delayedClose.tryClose(currentTimeNanos))
      break;
  }
}

代码示例来源:origin: robolectric/robolectric

@Nullable
static Object eldest(LinkedHashMap map) {
 return map.isEmpty() ? null : map.entrySet().iterator().next();
}

代码示例来源:origin: spring-projects/spring-security

private AuthenticationEntryPoint createDefaultEntryPoint(H http) {
  if (this.defaultEntryPointMappings.isEmpty()) {
    return new Http403ForbiddenEntryPoint();
  }
  if (this.defaultEntryPointMappings.size() == 1) {
    return this.defaultEntryPointMappings.values().iterator().next();
  }
  DelegatingAuthenticationEntryPoint entryPoint = new DelegatingAuthenticationEntryPoint(
      this.defaultEntryPointMappings);
  entryPoint.setDefaultEntryPoint(this.defaultEntryPointMappings.values().iterator()
      .next());
  return entryPoint;
}

代码示例来源:origin: apache/flink

@Nonnull
@Override
public final RunnableFuture<SnapshotResult<KeyedStateHandle>> snapshot(
  long checkpointId,
  long timestamp,
  @Nonnull CheckpointStreamFactory streamFactory,
  @Nonnull CheckpointOptions checkpointOptions) throws Exception {
  if (kvStateInformation.isEmpty()) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Asynchronous RocksDB snapshot performed on empty keyed state at {}. Returning null.",
        timestamp);
    }
    return DoneFuture.of(SnapshotResult.empty());
  } else {
    return doSnapshot(checkpointId, timestamp, streamFactory, checkpointOptions);
  }
}

代码示例来源:origin: redisson/redisson

/**
 * Combines this store with the given store.
 *
 * @param store The store to combine with this store.
 * @return A store representing a combination of this store and the given store.
 */
protected Store<V> combineWith(Store<V> store) {
  if (entries.isEmpty()) {
    return store;
  } else if (store.entries.isEmpty()) {
    return this;
  }
  LinkedHashMap<Harmonized<V>, Entry<V>> entries = new LinkedHashMap<Harmonized<V>, Entry<V>>(this.entries);
  for (Entry<V> entry : store.entries.values()) {
    Entry<V> previousEntry = entries.remove(entry.getKey()), injectedEntry = previousEntry == null
        ? entry
        : combine(previousEntry, entry);
    entries.put(injectedEntry.getKey(), injectedEntry);
  }
  return new Store<V>(entries);
}

代码示例来源:origin: ethereum/ethereumj

private void finalizeBlock() {
  synchronized (this) {
    if (fromBlock >= toBlock && queuedBlocks.isEmpty())
      finishDownload();
    cnt++;
    if (cnt % 1000 == 0) logger.info("FastSync: downloaded receipts for " + cnt + " blocks.");
  }
  dbFlushManager.commit();
}

代码示例来源:origin: twosigma/beakerx

private boolean isCorrectEvent(Message message, CommActions commActions) {
 LinkedHashMap<String, LinkedHashMap> data = (LinkedHashMap) message.getContent().get("data");
 LinkedHashMap content = data.get("content");
 if (null != content && !content.isEmpty()) {
  String event = (String) content.getOrDefault("event", "");
  return commActions.getAction().equals(event);
 }
 return false;
}

代码示例来源:origin: spring-projects/spring-security

private AccessDeniedHandler createDefaultDeniedHandler(H http) {
  if (this.defaultDeniedHandlerMappings.isEmpty()) {
    return new AccessDeniedHandlerImpl();
  }
  if (this.defaultDeniedHandlerMappings.size() == 1) {
    return this.defaultDeniedHandlerMappings.values().iterator().next();
  }
  return new RequestMatcherDelegatingAccessDeniedHandler(
      this.defaultDeniedHandlerMappings,
      new AccessDeniedHandlerImpl());
}

代码示例来源:origin: redisson/redisson

/**
 * Injects the given store into this store.
 *
 * @param store The key store to inject into this store.
 * @return A store that represents this store with the given store injected.
 */
protected Store<V> inject(Store<V> store) {
  if (entries.isEmpty()) {
    return store;
  } else if (store.entries.isEmpty()) {
    return this;
  }
  LinkedHashMap<Harmonized<V>, Entry<V>> entries = new LinkedHashMap<Harmonized<V>, Entry<V>>(this.entries);
  for (Entry<V> entry : store.entries.values()) {
    Entry<V> dominantEntry = entries.remove(entry.getKey()), injectedEntry = dominantEntry == null
        ? entry
        : dominantEntry.inject(entry.getKey(), entry.getVisibility());
    entries.put(injectedEntry.getKey(), injectedEntry);
  }
  return new Store<V>(entries);
}

代码示例来源:origin: spring-projects/spring-security

@Override
final ExpressionBasedFilterInvocationSecurityMetadataSource createMetadataSource(
    H http) {
  LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = REGISTRY
      .createRequestMap();
  if (requestMap.isEmpty()) {
    throw new IllegalStateException(
        "At least one mapping is required (i.e. authorizeRequests().anyRequest().authenticated())");
  }
  return new ExpressionBasedFilterInvocationSecurityMetadataSource(requestMap,
      getExpressionHandler(http));
}

代码示例来源:origin: lipangit/JiaoZiVideoPlayer

public void onEvent(int type) {
  if (JZ_USER_EVENT != null && isCurrentPlay() && !jzDataSource.urlsMap.isEmpty()) {
    JZ_USER_EVENT.onEvent(type, jzDataSource.getCurrentUrl(), currentScreen);
  }
}

代码示例来源:origin: jeasonlzy/okhttp-OkGo

/** 通用的拼接请求头 */
  public static Request.Builder appendHeaders(Request.Builder builder, HttpHeaders headers) {
    if (headers.headersMap.isEmpty()) return builder;
    Headers.Builder headerBuilder = new Headers.Builder();
    try {
      for (Map.Entry<String, String> entry : headers.headersMap.entrySet()) {
        //对头信息进行 utf-8 编码,防止头信息传中文,这里暂时不编码,可能出现未知问题,如有需要自行编码
//                String headerValue = URLEncoder.encode(entry.getValue(), "UTF-8");
        headerBuilder.add(entry.getKey(), entry.getValue());
      }
    } catch (Exception e) {
      OkLogger.printStackTrace(e);
    }
    builder.headers(headerBuilder.build());
    return builder;
  }

代码示例来源:origin: hibernate/hibernate-orm

@Override
  public void release() {
    if ( getStatements() != null && !getStatements().isEmpty() ) {
      LOG.batchContainedStatementsOnRelease();
    }
    releaseStatements();
    observers.clear();
  }
}

代码示例来源:origin: spring-projects/spring-security

private LogoutSuccessHandler createDefaultSuccessHandler() {
  SimpleUrlLogoutSuccessHandler urlLogoutHandler = new SimpleUrlLogoutSuccessHandler();
  urlLogoutHandler.setDefaultTargetUrl(logoutSuccessUrl);
  if (defaultLogoutSuccessHandlerMappings.isEmpty()) {
    return urlLogoutHandler;
  }
  DelegatingLogoutSuccessHandler successHandler = new DelegatingLogoutSuccessHandler(defaultLogoutSuccessHandlerMappings);
  successHandler.setDefaultLogoutSuccessHandler(urlLogoutHandler);
  return successHandler;
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public final void execute() {
  notifyObserversExplicitExecution();
  if ( getStatements().isEmpty() ) {
    return;
  }
  try {
    doExecuteBatch();
  }
  finally {
    releaseStatements();
  }
}

相关文章