Example usage for org.apache.commons.collections.map HashedMap HashedMap

List of usage examples for org.apache.commons.collections.map HashedMap HashedMap

Introduction

In this page you can find the example usage for org.apache.commons.collections.map HashedMap HashedMap.

Prototype

public HashedMap() 

Source Link

Document

Constructs a new empty map with default size and load factor.

Usage

From source file:com.pureinfo.srm.reports.table.data.sci.SCIBySchoolStatistic.java

public static void main(String[] args) throws PureException {
    IProductMgr mgr = (IProductMgr) ArkContentHelper.getContentMgrOf(Product.class);
    IStatement stat = mgr.createQuery(/* w w  w .j  av a  2s  .  com*/
            "select count({this.id}) _NUM, {this.englishScience} AS _SUB from {this} group by _SUB", 0);
    IObjects nums = stat.executeQuery(false);
    DolphinObject num = null;
    Map map = new HashedMap();
    while ((num = nums.next()) != null) {
        String subest = num.getStrProperty("_SUB");
        if (subest == null || subest.trim().length() == 0)
            continue;
        String[] subs = subest.split(";");
        int nNum = num.getIntProperty("_NUM", 0);
        for (int i = 0; i < subs.length; i++) {
            String sSub = subs[i].trim();
            Integer odValue = (Integer) map.get(sSub);
            int sum = odValue == null ? nNum : (nNum + odValue.intValue());
            map.put(sSub, new Integer(sum));
        }
    }
    List l = new ArrayList(map.size());

    for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) {
        Map.Entry en = (Map.Entry) iter.next();
        l.add(new Object[] { en.getKey(), en.getValue() });
    }
    Collections.sort(l, new Comparator() {

        public int compare(Object _sO1, Object _sO2) {
            Object[] arr1 = (Object[]) _sO1;
            Object[] arr2 = (Object[]) _sO2;
            Comparable s1 = (Comparable) arr1[1];
            Comparable s2 = (Comparable) arr2[01];
            return s1.compareTo(s2);
        }
    });
    for (Iterator iter = l.iterator(); iter.hasNext();) {
        Object[] arr = (Object[]) iter.next();
        System.out.println(arr[0] + " = " + arr[1]);
    }

}

From source file:com.twosigma.beakerx.groovy.autocomplete.GroovyCompleteHandlerTest.java

@BeforeClass
public static void setUpClass() {
    GroovyEvaluator groovyEvaluator = new GroovyEvaluator("id", "sid", cellExecutor(),
            EvaluatorTest.getTestTempFolderFactory(), new EvaluatorParameters(new HashedMap()),
            new EvaluatorTest.BeakexClientTestImpl(), new MagicCommandAutocompletePatternsMock());
    groovyKernel = new GroovyKernelMock("sid", groovyEvaluator);
}

From source file:com.kysoft.cpsi.audit.service.JsAuditServiceImpl.java

@Override
public Map<String, Object> getCompareInfo(String hcrwId, String hcsxId) {
    Map<String, Object> result = Maps.newHashMap();
    Hcsx hcsx = hcsxMapper.selectByPrimaryKey(hcsxId);
    String hcsxMc = hcsx.getName();
    Map<String, Object> param = new HashedMap();
    param.put("hcrwId", hcrwId);
    switch (hcsxMc) {
    case "?????":
        result.put("a", jsGqbgMapper.query(param));//??
        param.put("sjly", JS_GS_INFO_FLAG);
        result.put("b", jsGqbgMapper.queryBD(param));//?
        param.put("sjly", JS_GS_INFO_REAL);
        result.put("c", jsGqbgMapper.queryBD(param));//?
        break;//from  ww  w  .  j  a  v a  2  s  . c  o m
    case "??????":
        result.put("a", jsLicenseMapper.query(param));//??
        param.put("sjly", JS_GS_INFO_FLAG);
        result.put("b", jsLicenseMapper.queryBD(param));//?
        param.put("sjly", JS_GS_INFO_REAL);
        result.put("c", jsLicenseMapper.queryBD(param));//?
        break;
    case "??":
        result.put("a", jsZscqMapper.query(param));//??
        param.put("sjly", JS_GS_INFO_FLAG);
        result.put("b", jsZscqMapper.queryBD(param));//?
        param.put("sjly", JS_GS_INFO_REAL);
        result.put("c", jsZscqMapper.queryBD(param));//?
        break;
    case "?":
        result.put("a", jsXzcfMapper.query(param));//??
        param.put("sjly", JS_GS_INFO_FLAG);
        result.put("b", jsXzcfMapper.queryBD(param));//?
        param.put("sjly", JS_GS_INFO_REAL);
        result.put("c", jsXzcfMapper.queryBD(param));//?
        break;
    case "??":
        result.put("a", jsStockholderContributionMapper.query(param));//??
        param.put("sjly", JS_GS_INFO_FLAG);
        result.put("b", jsStockholderContributionMapper.queryBD(param));//?
        param.put("sjly", JS_GS_INFO_REAL);
        result.put("c", jsStockholderContributionMapper.queryBD(param));//?
        break;
    default:

    }
    return result;
}

From source file:com.orange.mmp.core.loader.DynamicClassLoaderFactory.java

/**
 * Default private constructor
 */
private DynamicClassLoaderFactory() {
    this.dynamicClassLoadersMap = new HashedMap();
}

From source file:com.wso2telco.claims.RemoteClaimsTelco.java

@Override
public Map<String, Object> getTotalClaims(String operatorEndPoint, CustomerInfo customerInfo) {

    Map<String, Object> totalClaims = new HashedMap();
    Customer customer = new Customer();
    try {//  w ww.jav  a2  s.  c o m
        String url = operatorEndPoint + "?msisdn=" + customerInfo.getMsisdn();
        HttpClient client = HttpClientBuilder.create().build();
        HttpGet request = new HttpGet(url);
        HttpResponse response = client.execute(request);
        log.info("Response Code : " + response.getStatusLine().getStatusCode());
        BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
        StringBuilder jsonString = new StringBuilder();
        String line = "";

        while ((line = rd.readLine()) != null) {
            jsonString.append(line);
        }
        Gson g = new Gson();
        customer = g.fromJson(jsonString.toString(), Customer.class);

    } catch (Exception ex) {
        log.error(ex);
    }

    totalClaims.put("name", customer.getFirstName());
    totalClaims.put("sub", customer.getSub());
    totalClaims.put("updated_at", customer.getUpdatedAt());
    totalClaims.put("title", customer.getTitle());
    totalClaims.put("given_name", customer.getGivenName());
    totalClaims.put("family_name", customer.getFamilyName());
    totalClaims.put("middle_name", customer.getMiddleName());
    totalClaims.put("gender", customer.getGender());
    totalClaims.put("birthdate", customer.getDob());
    totalClaims.put("AgeVerificationStatus", customer.isAgeVerificationStatus());
    totalClaims.put("street_address", customer.getStreetAddress());
    totalClaims.put("postal_code", customer.getPostalCode());
    totalClaims.put("country", customer.getCountry());
    totalClaims.put("locale", customer.getLocale());
    totalClaims.put("phone_number_alternate", customer.getPhoneNumberAlternate());
    totalClaims.put("email", customer.getEmail());
    totalClaims.put("email_verified", customer.getEmailVerified());
    totalClaims.put("phone_number", customer.getPhoneNumber());
    totalClaims.put("phone_number_country_code", customer.getPhoneNumberCountryCode());
    totalClaims.put("zoneinfo", customer.getZoneinfo());
    totalClaims.put("BillingSegment", customer.getBilingSegment());
    totalClaims.put("is_lost_stolen", customer.getIsLostStolen());
    totalClaims.put("id_hash", customer.getIdHash());
    totalClaims.put("SubscriptionActivity", customer.getSubscriptionActivity());
    totalClaims.put("LengthOfTenure", customer.getLengthOfTenure());
    totalClaims.put("pairing_change", customer.getPairingChange());
    totalClaims.put("is_roaming", customer.getIsRoaming());
    totalClaims.put("roaming_country", customer.getRoamingCountry());
    totalClaims.put("is_divert_set", customer.getIsDivertSet());
    totalClaims.put("location_country", customer.getLocationCountry());
    totalClaims.put("device_change", customer.getDeviceChange());
    totalClaims.put("msisdn", customer.getMsisdn());

    return totalClaims;
}

From source file:capital.scalable.restdocs.constraints.HumanReadableConstraintResolverTest.java

@Test
public void testHumanReadable() {
    // setup//w ww .j ava2  s.co m
    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);
}

From source file:cn.blaze.controller.NewsController.java

/**
 * ?//from  ww w .j  a va 2 s.c o  m
 * @param request
 * @param response
 * @param size
 * @throws IOException
 */
@RequestMapping("ajax/newsList")
public void newsList(HttpServletRequest request, HttpServletResponse response,
        @RequestParam(defaultValue = "10", required = false) int size) throws IOException {
    Map<String, Object> result = new HashedMap();
    List<NewsVO> newsList = newsService.queryNewList(size);
    result.put("newsList", newsList);
    writeJsonP(request, response, initAjaxResult(RetCode.SUCCESS.code, result));
    return;
}

From source file:com.twosigma.beaker.evaluator.EvaluatorManagerTest.java

@Test
public void setShellOptions_callEvaluatorToStartWorker() throws Exception {
    evaluator.clearStartWorkerFlag();/*from   w ww .ja v a2  s  . co m*/
    //when
    evaluatorManager.setShellOptions(new KernelParameters(new HashedMap()));
    //then
    Assertions.assertThat(evaluator.isCallStartWorker()).isTrue();
}

From source file:com.danidemi.templategeneratormavenplugin.maven.JuelRowFilterTest.java

private IRowModel newContextWithA(int a) {
    HashedMap context = new HashedMap();
    context.put("a", a);
    InMemoryRowModel rowModel = new InMemoryRowModel(context, new RowMetaModel(1, 2));
    return rowModel;
}

From source file:cn.blaze.controller.LogController.java

/**
 * ??/*from  ww w .java2 s.  c  o m*/
 * @param request
 * @param response
 * @throws IOException
 */
@ResponseBody
@RequestMapping("ajax/logList")
public void logList(HttpServletRequest request, HttpServletResponse response,
        @RequestParam(defaultValue = "", required = false) String actorid, @RequestParam String starttime,
        @RequestParam String endtime) throws IOException {
    Map<String, Object> result = new HashedMap();
    Date startDate = new Date();
    Date endDate = new Date();
    try {
        startDate = TimeUtils.parseTime(starttime);
        endDate = TimeUtils.parseTime(endtime);
    } catch (Exception e) {
        logger.error("[LogController parseTime error],starttime={},endtime={}", starttime, endtime);
        writeJsonP(request, response, initAjaxResult(RetCode.BAD_PARAMETER.code, result));
        return;
    }
    List<Log> logList = logService.queryLogList(actorid, startDate, endDate);
    result.put("logs", logList);
    writeJsonP(request, response, initAjaxResult(RetCode.SUCCESS.code, result));
    return;
}