本文整理汇总了Java中org.apache.commons.collections.map.HashedMap类的典型用法代码示例。如果您正苦于以下问题:Java HashedMap类的具体用法?Java HashedMap怎么用?Java HashedMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HashedMap类属于org.apache.commons.collections.map包,在下文中一共展示了HashedMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: providesKafkaInputStream
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
@Provides
JavaInputDStream<ConsumerRecord<String, RawRating>> providesKafkaInputStream(JavaStreamingContext streamingContext) {
Map<String, Object> kafkaParams = new HashedMap();
kafkaParams.put("bootstrap.servers", "localhost:9092");
kafkaParams.put("key.deserializer", StringDeserializer.class);
kafkaParams.put("value.deserializer", JsonDeserializer.class);
kafkaParams.put("serializedClass", RawRating.class);
kafkaParams.put("group.id", "rating_stream");
kafkaParams.put("auto.offset.reset", "latest");
kafkaParams.put("enable.auto.commit", false);
Collection<String> topics = Arrays.asList("topicA", "topicB");
return KafkaUtils.createDirectStream(
streamingContext,
LocationStrategies.PreferConsistent(),
ConsumerStrategies.<String, RawRating>Subscribe(topics, kafkaParams)
);
}
示例2: setLoginEntity
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
@Override
public void setLoginEntity(LoginEntity loginEntity) {
Map<String, Object> params = new HashedMap();
params.put("user", "fc7kj");
params.put("pwd", MD5Utils.digest("zhang520"));
params.put("service", "http://i.wan.liebao.cn/login?go=http://wan.liebao.cn/game_frame/play_1087.php?sid=22&supplier_id=2");
params.put("rm", "1");
params.put("cn", "a6742619ae9d91bfb87b0f9507c8d0ad");
loginEntity.setParams(params);
loginEntity.setLoginUrl("https://login.ijinshan.com/webgame/w/loginpage.html");
loginEntity.setActionUrl("https://login.ijinshan.com/login");
loginEntity.setCodeUrl("https://login.ijinshan.com/imgCode?_dc=" + (System.currentTimeMillis()) + "&cn=a6742619ae9d91bfb87b0f9507c8d0ad");
loginEntity.setCharset("UTF-8");
loginEntity.setUnEscape(true);
loginEntity.setMark("用户名或密码错误;验证错误;验证码错误;登录失败;");
}
示例3: setLoginEntity
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
@Override
public void setLoginEntity(LoginEntity loginEntity) {
Map<String, Object> params = new HashedMap();
params.put("user", "fc7kj");
params.put("pwd", MD5Utils.digest("zhang520"));
params.put("service", "");
params.put("rm", "1");
params.put("cn", "b06aa38e7641826933720e37f481ac7c");
loginEntity.setParams(params);
loginEntity.setLoginUrl("https://login.ijinshan.com/login.html");
loginEntity.setActionUrl("https://login.ijinshan.com/login");
loginEntity.setCodeUrl("https://login.ijinshan.com/imgCode?_dc=" + (System.currentTimeMillis()) + "&cn=b06aa38e7641826933720e37f481ac7c");
loginEntity.setCharset("UTF-8");
loginEntity.setUnEscape(true);
loginEntity.setMark("用户名或密码错误;验证错误;验证码错误;登录失败;");
loginEntity.setActionUrl("https://login.ijinshan.com/login");
}
示例4: getGrids
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
/**
* 数据表grid查询 It's not good enough
* @param pageIndex
* @param pageSize
* @param paramsMap 给criteria添加参数使用
* @return
*/
private Map<String, Object> getGrids(int pageIndex, int pageSize, HashMap<String, String> paramsMap) {
PageRowBounds rowBounds = new PageRowBounds(pageIndex+1, pageSize);
SqlSession sqlSession = MybatisHelper.getSqlSession();
Mapper mapper = (Mapper) sqlSession.getMapper(UUserMapper.class);
Example example = new Example(UUser.class);
Example.Criteria criteria = example.createCriteria();
/*criteria增加条件...*/
List<UUser> users = (List<UUser>) mapper.selectByExampleAndRowBounds(example, rowBounds);
/*4.构造适合miniui_grid展示的map*/
Map<String, Object> map_grid = new HashedMap();
map_grid.put("total", users.size());
map_grid.put("data", users);
return map_grid;
}
示例5: register
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
/**
* 注册
* JavaBean: User这种的bean会自动返回给前端
*
* @param user
* @param model
* @param response
*/
@RequestMapping("/register")
public void register(UUser user, Model model, HttpServletResponse response) {
Map<String, Object> remap = new HashedMap();
try {
boolean b = userFService.registerUser(user);
if (b) {
log.info("注册普通用户" + user.getUsername() + "成功。");
remap.put("msg", "恭喜您," + user.getUsername() + "注册成功。");
HttpRespUtil.respJson(StatusEnum.SUCCESS, remap, response);
} else {
remap.put("msg", "用户名已存在。");
HttpRespUtil.respJson(StatusEnum.SUCCESS, remap, response);
}
} catch (Exception e) {
log.debug("注册普通用户" + user.getUsername() + "异常");
remap.put("msg","注册普通用户异常");
HttpRespUtil.respJson(StatusEnum.FAIL, remap, response);
e.printStackTrace();
}
}
示例6: makeFeatureModelForTesting
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
private Map<Integer,Map<String,Object>> makeFeatureModelForTesting(DateSeriesDataSetModel ds) {
Map<Integer,Map<String,Object>> items = new HashMap<>();
//make a copy
INDArray features = ds.getDataSet().copy().getFeatureMatrix();
try {
List<List<Double>> rows = NDArrayUtils.makeRowsFromNDArray(features,6);
for (int i = 0; i < rows.size(); i++) {
List<Double> row = rows.get(i);
Map<String,Object> itemModel = new HashedMap();
itemModel.put("seriesNumber",i);
itemModel.put("seriesData",row);
itemModel.put("seriesName", ds.getSeriesNames().get(i));
items.put(i,itemModel);
}
} catch (IOException e) {
e.printStackTrace();
}
return items;
}
示例7: testSetDetailsWithRootCredentials
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
@Test
public void testSetDetailsWithRootCredentials() {
final HostResponse hostResponse = new HostResponse();
final Map details = new HashMap<>();
details.put(VALID_KEY, VALID_VALUE);
details.put("username", "test");
details.put("password", "password");
final Map expectedDetails = new HashedMap();
expectedDetails.put(VALID_KEY, VALID_VALUE);
hostResponse.setDetails(details);
final Map actualDetails = hostResponse.getDetails();
assertTrue(details != actualDetails);
assertEquals(expectedDetails, actualDetails);
}
示例8: testSetDetailsWithoutRootCredentials
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
@Test
public void testSetDetailsWithoutRootCredentials() {
final HostResponse hostResponse = new HostResponse();
final Map details = new HashMap<>();
details.put(VALID_KEY, VALID_VALUE);
final Map expectedDetails = new HashedMap();
expectedDetails.put(VALID_KEY, VALID_VALUE);
hostResponse.setDetails(details);
final Map actualDetails = hostResponse.getDetails();
assertTrue(details != actualDetails);
assertEquals(expectedDetails, actualDetails);
}
示例9: getPage
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
@Request("page/{id}")
public Result getPage(@PathParam("id") Id id, @Context HttpServletRequest request,
@Context HttpServletResponse response) {
Content content = contents.findById(Content.class, id);
app.setViewPath("page/content/view_" + id.str());
app.setActionURI(request.getRequestURI());
Map<String, Object> params = new HashedMap();
if (content.getPreviewProductId() != null) {
params.put("product", productService.getProduct(content.getPreviewProductId()));
}
Result result = freemarkerTemplateStream(content.getTemplate(), params, "3h");
if (content.getPreviewProductId() != null) {
result.bind("product", productService.getProduct(content.getPreviewProductId()));
}
return result;
}
示例10: getProductPage
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
@Request("product/{id}")
public Result getProductPage(@PathParam("id") Id id, @Context HttpServletRequest request,
@Context HttpServletResponse response) {
Product product = productService.getProduct(id);
Content content = contents.findById(Content.class, product.getTemplateId());
app.setViewPath("page/content/view_" + content.getId().str() + "_" + product.getId());
app.setActionURI(request.getRequestURI());
Map<String, Object> params = new HashedMap();
params.put("product", product);
Result result = freemarkerTemplateStream(content.getTemplate(),params, "3h");
result.bind("product", product);
return result;
}
示例11: alterationsToString
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
private static String alterationsToString(Collection<Alteration> alterations) {
Map<Gene, Set<String>> mapGeneVariants = new HashedMap();
for (Alteration alteration : alterations) {
Gene gene = alteration.getGene();
Set<String> variants = mapGeneVariants.get(gene);
if (variants == null) {
variants = new HashSet<>();
mapGeneVariants.put(gene, variants);
}
variants.add(alteration.getName());
}
List<String> list = new ArrayList<>();
for (Map.Entry<Gene, Set<String>> entry : mapGeneVariants.entrySet()) {
for (String variant : entry.getValue()) {
list.add(getGeneMutationNameInVariantSummary(alterations.iterator().next().getGene(), variant));
}
}
String ret = MainUtils.listToString(list, " or ");
return ret;
}
示例12: serializeSettings
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
private Map<String, Object> serializeSettings() {
final Map<String, Object> result = new HashedMap();
result.put("isCourseLetterGradeDisplayed", settings.isCourseLetterGradeDisplayed());
result.put("isCourseAverageDisplayed", settings.isCourseAverageDisplayed());
result.put("isCoursePointsDisplayed", settings.isCoursePointsDisplayed());
result.put("isPointsGradeEntry", GradingType.valueOf(settings.getGradeType()).equals(GradingType.POINTS));
result.put("isPercentageGradeEntry", GradingType.valueOf(settings.getGradeType()).equals(GradingType.PERCENTAGE));
result.put("isCategoriesEnabled", GbCategoryType.valueOf(settings.getCategoryType()) != GbCategoryType.NO_CATEGORY);
result.put("isCategoryTypeWeighted", GbCategoryType.valueOf(settings.getCategoryType()) == GbCategoryType.WEIGHTED_CATEGORY);
result.put("isStudentOrderedByLastName", uiSettings.getNameSortOrder() == GbStudentNameSortOrder.LAST_NAME);
result.put("isStudentOrderedByFirstName", uiSettings.getNameSortOrder() == GbStudentNameSortOrder.FIRST_NAME);
result.put("isGroupedByCategory", uiSettings.isGroupedByCategory());
result.put("isCourseGradeReleased", settings.isCourseGradeDisplayed());
result.put("showPoints", uiSettings.getShowPoints());
result.put("instructor", isInstructor());
result.put("isStudentNumberVisible", this.isStudentNumberVisible);
return result;
}
示例13: testHumanReadable
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
@Test
public void testHumanReadable() {
// setup
Map<String, Object> configuration = new HashedMap();
configuration.put("primitive", 1);
configuration.put("wrapper", 1);
configuration.put("object", new CustomObj("Peter"));
configuration.put("array", new Object[]{"value1", "value2"});
configuration.put("class", CustomConstraint.class);
configuration.put("groups", new Class<?>[]{Update.class});
configuration.put("payload", new Class<?>[0]);
Constraint constraint = new Constraint("Custom", configuration);
when(delegate.resolveForProperty("prop", this.getClass()))
.thenReturn(singletonList(constraint));
when(delegate.resolveForParameter(any(MethodParameter.class)))
.thenReturn(singletonList(constraint));
List<Constraint> constraints = resolver.resolveForProperty("prop", this.getClass());
assertConstraints(constraints);
constraints = resolver.resolveForParameter(Mockito.mock(MethodParameter.class));
assertConstraints(constraints);
}
示例14: doFullTest
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
/**
* fold: 表示十折交叉验证的第几个
*/
public void doFullTest(File rawCorpusDir, File miningDir, boolean raw, boolean esa, boolean espm, boolean espmesa, int fold) {
Map<String, Double> results = new HashedMap();
StringBuilder sb = new StringBuilder();
if (raw) {
runTask("BoW", rawCorpusDir, miningDir, fold, MyPipe.Type.PURE_BOW);
}
if (esa) {
runTask("ESA", rawCorpusDir, miningDir, fold, MyPipe.Type.PURE_ESA);
runTask("BoW+ESA", rawCorpusDir, miningDir, fold, MyPipe.Type.BOW_ESA);
}
if (espm) {
runTask("ESPM", rawCorpusDir, miningDir, fold, MyPipe.Type.PURE_ESPM);
runTask("BoW+ESPM", rawCorpusDir, miningDir, fold, MyPipe.Type.BOW_ESPM);
}
if (espmesa) {
runTask("ESPM+ESA", rawCorpusDir, miningDir, fold, MyPipe.Type.PURE_ESPM_ESA);
runTask("BoW+ESPM+ESA", rawCorpusDir, miningDir, fold, MyPipe.Type.BOW_ESPM_ESA);
}
}
示例15: calculateByPackage
import org.apache.commons.collections.map.HashedMap; //导入依赖的package包/类
@Deprecated
public Map<String, NGrams> calculateByPackage(List<CtType<?>> all) throws JSAPException {
Map<String, NGrams> result = new HashedMap();
IngredientProcessor ingp = new IngredientProcessor<>(ingredientProcessor);
int allElements = 0;
for (CtType<?> ctType : all) {
NGrams ns = new NGrams();
CtPackage parent = (CtPackage) ctType.getParent(CtPackage.class);
if (!result.containsKey(parent.getQualifiedName())) {
allElements += getNGramsFromCodeElements(parent, ns, ingp);
result.put(parent.getQualifiedName(), ns);
}
}
logger.debug("allElements " + allElements);
return result;
}