scala.collection.immutable.Map.keySet()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(181)

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

Map.keySet介绍

暂无

代码示例

代码示例来源:origin: pac4j/play-pac4j

/**
 * We retrieve the body apart from the request. Otherwise, there is an issue in casting the body between Scala and Java.
 *
 * @param requestHeader the request without the body
 * @param body the body (maybe)
 * @param sessionStore the session store
 */
public PlayWebContext(final RequestHeader requestHeader, final Object body, final SessionStore<org.pac4j.play.PlayWebContext> sessionStore) {
  this(JavaHelpers$.MODULE$.createJavaContext(requestHeader, JavaHelpers$.MODULE$.createContextComponents()), sessionStore);
  this.formParameters = new HashMap<>();
  if (body instanceof AnyContentAsFormUrlEncoded) {
    final scala.collection.immutable.Map<String, Seq<String>> parameters = ((AnyContentAsFormUrlEncoded) body).asFormUrlEncoded().get();
    for (final String key : ScalaCompatibility.scalaSetToJavaSet(parameters.keySet())) {
      final Seq<String> v = parameters.get(key).get();
      final String[] values = new String[v.size()];
      v.copyToArray(values);
      formParameters.put(key, values);
    }
  }
}

代码示例来源:origin: pac4j/play-pac4j

/**
 * We retrieve the body apart from the request. Otherwise, there is an issue in casting the body between Scala and Java.
 *
 * @param requestHeader the request without the body
 * @param body the body (maybe)
 * @param sessionStore the session store
 */
public PlayWebContext(final RequestHeader requestHeader, final Object body, final SessionStore<org.pac4j.play.PlayWebContext> sessionStore) {
  this(JavaHelpers$.MODULE$.createJavaContext(requestHeader, JavaHelpers$.MODULE$.createContextComponents()), sessionStore);
  this.formParameters = new HashMap<>();
  if (body instanceof AnyContentAsFormUrlEncoded) {
    final scala.collection.immutable.Map<String, Seq<String>> parameters = ((AnyContentAsFormUrlEncoded) body).asFormUrlEncoded().get();
    for (final String key : ScalaCompatibility.scalaSetToJavaSet(parameters.keySet())) {
      final Seq<String> v = parameters.get(key).get();
      final String[] values = new String[v.size()];
      v.copyToArray(values);
      formParameters.put(key, values);
    }
  }
}

相关文章