• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HashMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中scala.collection.mutable.HashMap的典型用法代码示例。如果您正苦于以下问题:Java HashMap类的具体用法?Java HashMap怎么用?Java HashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HashMap类属于scala.collection.mutable包,在下文中一共展示了HashMap类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: populateSparkWebUrl

import scala.collection.mutable.HashMap; //导入依赖的package包/类
public void populateSparkWebUrl(InterpreterContext ctx) {
  sparkUrl = getSparkUIUrl();
  Map<String, String> infos = new java.util.HashMap<>();
  infos.put("url", sparkUrl);
  String uiEnabledProp = getProperty("spark.ui.enabled", "true");
  java.lang.Boolean uiEnabled = java.lang.Boolean.parseBoolean(
          uiEnabledProp.trim());
  if (!uiEnabled) {
    infos.put("message", "Spark UI disabled");
  } else {
    if (StringUtils.isNotBlank(sparkUrl)) {
      infos.put("message", "Spark UI enabled");
    } else {
      infos.put("message", "No spark url defined");
    }
  }
  if (ctx != null && ctx.getClient() != null) {
    logger.info("Sending metadata to Zeppelin server: {}", infos.toString());
    getZeppelinContext().setEventClient(ctx.getClient());
    ctx.getClient().onMetaInfosReceived(infos);
  }
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:23,代码来源:SparkInterpreter.java


示例2: getProgressFromStage_1_0x

import scala.collection.mutable.HashMap; //导入依赖的package包/类
private int[] getProgressFromStage_1_0x(JobProgressListener sparkListener, Object stage)
    throws IllegalAccessException, IllegalArgumentException,
    InvocationTargetException, NoSuchMethodException, SecurityException {
  int numTasks = (int) stage.getClass().getMethod("numTasks").invoke(stage);
  int completedTasks = 0;

  int id = (int) stage.getClass().getMethod("id").invoke(stage);

  Object completedTaskInfo = null;

  completedTaskInfo = JavaConversions.asJavaMap(
      (HashMap<Object, Object>) sparkListener.getClass()
          .getMethod("stageIdToTasksComplete").invoke(sparkListener)).get(id);

  if (completedTaskInfo != null) {
    completedTasks += (int) completedTaskInfo;
  }
  List<Object> parents = JavaConversions.asJavaList((Seq<Object>) stage.getClass()
      .getMethod("parents").invoke(stage));
  if (parents != null) {
    for (Object s : parents) {
      int[] p = getProgressFromStage_1_0x(sparkListener, s);
      numTasks += p[0];
      completedTasks += p[1];
    }
  }

  return new int[] {numTasks, completedTasks};
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:30,代码来源:SparkInterpreter.java


示例3: getProgressFromStage_1_1x

import scala.collection.mutable.HashMap; //导入依赖的package包/类
private int[] getProgressFromStage_1_1x(JobProgressListener sparkListener, Object stage)
    throws IllegalAccessException, IllegalArgumentException,
    InvocationTargetException, NoSuchMethodException, SecurityException {
  int numTasks = (int) stage.getClass().getMethod("numTasks").invoke(stage);
  int completedTasks = 0;
  int id = (int) stage.getClass().getMethod("id").invoke(stage);

  try {
    Method stageIdToData = sparkListener.getClass().getMethod("stageIdToData");
    HashMap<Tuple2<Object, Object>, Object> stageIdData =
        (HashMap<Tuple2<Object, Object>, Object>) stageIdToData.invoke(sparkListener);
    Class<?> stageUIDataClass =
        this.getClass().forName("org.apache.spark.ui.jobs.UIData$StageUIData");

    Method numCompletedTasks = stageUIDataClass.getMethod("numCompleteTasks");
    Set<Tuple2<Object, Object>> keys =
        JavaConverters.asJavaSetConverter(stageIdData.keySet()).asJava();
    for (Tuple2<Object, Object> k : keys) {
      if (id == (int) k._1()) {
        Object uiData = stageIdData.get(k).get();
        completedTasks += (int) numCompletedTasks.invoke(uiData);
      }
    }
  } catch (Exception e) {
    logger.error("Error on getting progress information", e);
  }

  List<Object> parents = JavaConversions.asJavaList((Seq<Object>) stage.getClass()
      .getMethod("parents").invoke(stage));
  if (parents != null) {
    for (Object s : parents) {
      int[] p = getProgressFromStage_1_1x(sparkListener, s);
      numTasks += p[0];
      completedTasks += p[1];
    }
  }
  return new int[] {numTasks, completedTasks};
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:39,代码来源:SparkInterpreter.java


示例4: getProgressFromStage_1_0x

import scala.collection.mutable.HashMap; //导入依赖的package包/类
private int[] getProgressFromStage_1_0x(JobProgressListener sparkListener, Object stage)
    throws IllegalAccessException, IllegalArgumentException,
    InvocationTargetException, NoSuchMethodException, SecurityException {
  int numTasks = (int) stage.getClass().getMethod("numTasks").invoke(stage);
  int completedTasks = 0;

  int id = (int) stage.getClass().getMethod("id").invoke(stage);

  Object completedTaskInfo = null;

  completedTaskInfo = JavaConversions.mapAsJavaMap(
      (HashMap<Object, Object>) sparkListener.getClass()
          .getMethod("stageIdToTasksComplete").invoke(sparkListener)).get(id);

  if (completedTaskInfo != null) {
    completedTasks += (int) completedTaskInfo;
  }
  List<Object> parents = JavaConversions.seqAsJavaList((Seq<Object>) stage.getClass()
      .getMethod("parents").invoke(stage));
  if (parents != null) {
    for (Object s : parents) {
      int[] p = getProgressFromStage_1_0x(sparkListener, s);
      numTasks += p[0];
      completedTasks += p[1];
    }
  }

  return new int[] {numTasks, completedTasks};
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:30,代码来源:SparkInterpreter.java


示例5: getProgressFromStage_1_1x

import scala.collection.mutable.HashMap; //导入依赖的package包/类
private int[] getProgressFromStage_1_1x(JobProgressListener sparkListener, Object stage)
    throws IllegalAccessException, IllegalArgumentException,
    InvocationTargetException, NoSuchMethodException, SecurityException {
  int numTasks = (int) stage.getClass().getMethod("numTasks").invoke(stage);
  int completedTasks = 0;
  int id = (int) stage.getClass().getMethod("id").invoke(stage);

  try {
    Method stageIdToData = sparkListener.getClass().getMethod("stageIdToData");
    HashMap<Tuple2<Object, Object>, Object> stageIdData =
        (HashMap<Tuple2<Object, Object>, Object>) stageIdToData.invoke(sparkListener);
    Class<?> stageUIDataClass =
        this.getClass().forName("org.apache.spark.ui.jobs.UIData$StageUIData");

    Method numCompletedTasks = stageUIDataClass.getMethod("numCompleteTasks");
    Set<Tuple2<Object, Object>> keys =
        JavaConverters.setAsJavaSetConverter(stageIdData.keySet()).asJava();
    for (Tuple2<Object, Object> k : keys) {
      if (id == (int) k._1()) {
        Object uiData = stageIdData.get(k).get();
        completedTasks += (int) numCompletedTasks.invoke(uiData);
      }
    }
  } catch (Exception e) {
    logger.error("Error on getting progress information", e);
  }

  List<Object> parents = JavaConversions.seqAsJavaList((Seq<Object>) stage.getClass()
      .getMethod("parents").invoke(stage));
  if (parents != null) {
    for (Object s : parents) {
      int[] p = getProgressFromStage_1_1x(sparkListener, s);
      numTasks += p[0];
      completedTasks += p[1];
    }
  }
  return new int[] {numTasks, completedTasks};
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:39,代码来源:SparkInterpreter.java


示例6: testVertexPath

import scala.collection.mutable.HashMap; //导入依赖的package包/类
@Test
public void testVertexPath() throws Exception {
    DecisionTree<Long> tree  = new DecisionTree<>(0L, new HashMap<>());
    tree.traverseTo(0L).addLeaf(1L);
    tree.traverseTo(0L).addLeaf(2L).addLeaf(3L).addLeaf(4L).addLeaf(5L);
    tree.traverseTo(4L).addLeaf(6L);
    tree.traverseTo(4L).addLeaf(7L).addLeaf(8L);
    tree.traverseTo(7L).addLeaf(9L);
    System.out.println(tree.renderGraph());

    System.out.println(tree.shortestPathTo(9L));
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mazerunner,代码行数:13,代码来源:GraphProcessorTest.java


示例7: getProgressFromStage_1_1x

import scala.collection.mutable.HashMap; //导入依赖的package包/类
private int[] getProgressFromStage_1_1x(JobProgressListener sparkListener, Stage stage) {
    int numTasks = stage.numTasks();
    int completedTasks = 0;

    try {
        Method stageIdToData = sparkListener.getClass().getMethod("stageIdToData");
        HashMap<Tuple2<Object, Object>, Object> stageIdData = (HashMap<Tuple2<Object, Object>, Object>) stageIdToData
                .invoke(sparkListener);
        Class<?> stageUIDataClass = this.getClass().forName("org.apache.spark.ui.jobs.UIData$StageUIData");

        Method numCompletedTasks = stageUIDataClass.getMethod("numCompleteTasks");

        Set<Tuple2<Object, Object>> keys = JavaConverters.asJavaSetConverter(stageIdData.keySet()).asJava();
        for (Tuple2<Object, Object> k : keys) {
            if (stage.id() == (int) k._1()) {
                Object uiData = stageIdData.get(k).get();
                completedTasks += (int) numCompletedTasks.invoke(uiData);
            }
        }
    } catch (Exception e) {
        logger.error("Error on getting progress information", e);
    }

    List<Stage> parents = JavaConversions.asJavaList(stage.parents());
    if (parents != null) {
        for (Stage s : parents) {
            int[] p = getProgressFromStage_1_1x(sparkListener, s);
            numTasks += p[0];
            completedTasks += p[1];
        }
    }
    return new int[] { numTasks, completedTasks };
}
 
开发者ID:Stratio,项目名称:Explorer,代码行数:34,代码来源:SparkInterpreter.java


示例8: KruxProducerEventHandler

import scala.collection.mutable.HashMap; //导入依赖的package包/类
public KruxProducerEventHandler(ProducerConfig config, Partitioner partitioner, Encoder encoder, Encoder keyEncoder,
        ProducerPool producerPool, HashMap topicPartitionInfos) {
    super(config, partitioner, encoder, keyEncoder, producerPool, topicPartitionInfos);
    // TODO Auto-generated constructor stub
}
 
开发者ID:krux,项目名称:tcp-stream-kafka-producer,代码行数:6,代码来源:KruxProducerEventHandler.java


示例9: testPatternMatchTraversal

import scala.collection.mutable.HashMap; //导入依赖的package包/类
@Test
public void testPatternMatchTraversal() throws Exception {
    // Invalidate all caches
    NodeManager.globalNodeCache.invalidateAll();
    DataNodeManager.dataCache.invalidateAll();
    ClassNodeManager.classCache.invalidateAll();
    GraphManager.edgeCache.invalidateAll();
    GraphManager.inversePatternCache.invalidateAll();
    GraphManager.patternCache.invalidateAll();
    DataRelationshipManager.relationshipCache.invalidateAll();
    ClassRelationshipCache.relationshipCache.invalidateAll();
    PatternRelationshipCache.relationshipCache.invalidateAll();

    GraphManager graphManager = new GraphManager("Pattern");
    GraphDatabaseService db = setUpDb();
    DecisionTree<Long> tree = new DecisionTree<>(0L, new HashMap<>(), db, graphManager);

    // Creates a hierarchical graph of branch factor 2 with depth 5
    createHierarchy(db, graphManager, null, 2, 5, 0, "[0-9]");

    //System.out.println(tree.traverseTo(1L).renderGraph());

    nodeManager.setNodeProperty(0L, "pattern",
            String.join(" ", Arrays.asList("The first person to go to space was smart".split(" "))
                    .subList(0, 1)), db);

    nodeManager.setNodeProperty(1L, "pattern",
            String.join(" ", Arrays.asList("The first person to go to space was smart".split(" "))
                    .subList(0, 2)), db);

    nodeManager.setNodeProperty(2L, "pattern",
            String.join(" ", Arrays.asList("The first person to go to space was smart".split(" "))
                    .subList(0, 3)), db);

    nodeManager.setNodeProperty(3L, "pattern",
            String.join(" ", Arrays.asList("The first person to go to space was smart".split(" "))
                    .subList(0, 4)), db);

    nodeManager.setNodeProperty(7L, "pattern",
            String.join(" ", Arrays.asList("The first person to go to space was smart".split(" "))
                    .subList(0, 5)), db);

    nodeManager.setNodeProperty(9L, "pattern",
            String.join(" ", Arrays.asList("The first person to go to space was smart".split(" "))
                    .subList(0, 6)), db);

    graphManager.updateCache(0L, db);
    graphManager.updateCache(1L, db);
    graphManager.updateCache(2L, db);
    graphManager.updateCache(3L, db);
    graphManager.updateCache(7L, db);
    graphManager.updateCache(9L, db);

    // Traverse by pattern
    System.out.println(tree.traverseByPattern("The first person to go to space was smart"));

    System.out.println(tree.renderGraph());
}
 
开发者ID:Graphify,项目名称:graphify,代码行数:59,代码来源:DecisionTreeTest.java



注:本文中的scala.collection.mutable.HashMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ApplicationHistoryData类代码示例发布时间:2022-05-22
下一篇:
Java PIDSourceParameter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap