List of usage examples for java.util LinkedHashMap LinkedHashMap
public LinkedHashMap()
From source file:it.unicaradio.android.models.Schedule.java
private Schedule() { transmissions = new LinkedHashMap<Day, List<Transmission>>(); }
From source file:org.openmrs.module.imbmetadata.deploy.bundle.GlobalPropertyBundle.java
/** * @see AbstractMetadataBundle#install() *//*from w w w . ja va 2 s . c o m*/ @Override public void install() { log.info("Installing Global Properties"); Map<String, String> properties = new LinkedHashMap<String, String>(); // Configure EMR API Module // TODO: Fill these in once they are defined and created properties.put(EmrApiConstants.GP_ADMISSION_ENCOUNTER_TYPE, EncounterTypes.ADMISSION.UUID); properties.put(EmrApiConstants.GP_TRANSFER_WITHIN_HOSPITAL_ENCOUNTER_TYPE, EncounterTypes.TRANSFER_WITHIN_HOSPITAL.UUID); properties.put(EmrApiConstants.GP_EXIT_FROM_INPATIENT_ENCOUNTER_TYPE, EncounterTypes.EXIT_FROM_INPATIENT.UUID); properties.put(EmrApiConstants.GP_CHECK_IN_ENCOUNTER_TYPE, EncounterTypes.CHECK_IN.UUID); properties.put(EmrApiConstants.GP_AT_FACILITY_VISIT_TYPE, ""); properties.put(EmrApiConstants.GP_DIAGNOSIS_SET_OF_SETS, ""); setGlobalProperties(properties); }
From source file:Main.java
private static ArrayList<ArrayList> sortObjectArrayListSimpleMaster(ArrayList listIn, String paramName) { ArrayList<ArrayList> answer = new ArrayList<ArrayList>(); ArrayList newList = new ArrayList(); ArrayList<Integer> indices = new ArrayList<Integer>(); try {/* w w w . j ava2s. c om*/ if (listIn.size() > 0) { Class<?> c = listIn.get(0).getClass(); Field f = c.getDeclaredField(paramName); f.setAccessible(true); Class<?> t = f.getType(); Double dd = new Double(14); Float ff = new Float(14); Integer ii = new Integer(14); Map sortedPos = new LinkedHashMap(); Map sortedNeg = new LinkedHashMap(); Map unsorted = new LinkedHashMap(); int indexCount = 0; long count = 0; if (t.isPrimitive()) { for (Object thisObj : listIn) { Object o = f.get(thisObj); double d = 0; if (t.getName().equals("char")) { d = (int) ((Character) o); } else if (t.isInstance(dd)) d = (Double) o; else if (t.isInstance(ff)) d = (Float) o; else if (t.isInstance(ii)) d = (Integer) o; else d = new Double(o.toString()); boolean isNegative = false; if (d < 0) { isNegative = true; d = Math.abs(d); } String format = "%1$30f"; String newKey = String.format(format, d); String format2 = "%1$20d"; String countString = String.format(format2, count); newKey += "-" + countString; if (isNegative) { sortedNeg.put(newKey, thisObj); } else { sortedPos.put(newKey, thisObj); } unsorted.put(thisObj, indexCount); count++; indexCount++; } TreeMap<String, Object> resultPos = new TreeMap(); resultPos.putAll(sortedPos); sortedPos = resultPos; TreeMap<String, Object> resultNeg = new TreeMap(); resultNeg.putAll(sortedNeg); sortedNeg = resultNeg; } else if (t.isInstance(paramName)) { // System.out.println("is a string with value " + o); for (Object thisObj : listIn) { String key = (String) (f.get(thisObj)); sortedPos.put(key + "-" + count, thisObj); unsorted.put(thisObj, indexCount); count++; indexCount++; } TreeMap<String, Object> result = new TreeMap(String.CASE_INSENSITIVE_ORDER); result.putAll(sortedPos); sortedPos = result; } Iterator itNeg = sortedNeg.entrySet().iterator(); while (itNeg.hasNext()) { Map.Entry pairs = (Map.Entry) itNeg.next(); newList.add(pairs.getValue()); itNeg.remove(); } Collections.reverse(newList); Iterator itPos = sortedPos.entrySet().iterator(); while (itPos.hasNext()) { Map.Entry pairs = (Map.Entry) itPos.next(); Object obj = pairs.getValue(); newList.add(obj); indices.add((Integer) unsorted.get(obj)); itPos.remove(); } } } catch (Exception e) { System.out .println("problem sorting list. listIn.size(): " + listIn.size() + " and param: " + paramName); answer.add(newList); answer.add(indices); return answer; } answer.add(newList); answer.add(indices); return answer; }
From source file:org.openmrs.module.htmlformentry.DrugCompatibility1_9.java
@Override public List<Map<String, Object>> simplify(List<Drug> drugs) { List<Map<String, Object>> simplified = new ArrayList<Map<String, Object>>(); Locale locale = Context.getLocale(); for (Drug drug : drugs) { Map<String, Object> item = new LinkedHashMap<String, Object>(); item.put("id", drug.getId()); item.put("name", drug.getName()); if (drug.getDosageForm() != null) { item.put("dosageForm", drug.getDosageForm().getName(locale).getName()); }/*from ww w .j a va2s . c o m*/ if (drug.getRoute() != null) { item.put("route", drug.getRoute().getName(locale).getName()); } item.put("doseStrength", drug.getDoseStrength()); item.put("units", drug.getUnits()); item.put("combination", drug.getCombination()); if (drug.getConcept() != null) { item.put("concept", drug.getConcept().getName(locale).getName()); } simplified.add(item); } return simplified; }
From source file:com.glaf.shiro.MyShiroFilterFactoryBean.java
public MyShiroFilterFactoryBean() { super(); this.filterChainDefinitionMap = new LinkedHashMap<String, String>(); }
From source file:io.servicecomb.springboot.starter.configuration.CseEndpoint.java
@Override public Map<String, Object> invoke() { Map<String, Object> map = new LinkedHashMap<String, Object>(); AbstractConfiguration config = ConfigurationManager.getConfigInstance(); if (config instanceof ConcurrentCompositeConfiguration) { ConcurrentCompositeConfiguration composite = (ConcurrentCompositeConfiguration) config; for (Configuration item : composite.getConfigurations()) { append(map, item);// w ww . j av a2 s . com } } else { append(map, config); } return map; }
From source file:io.spring.initializr.actuate.info.BomRangesInfoContributor.java
@Override public void contribute(Info.Builder builder) { Map<String, Object> details = new LinkedHashMap<>(); this.metadataProvider.get().getConfiguration().getEnv().getBoms().forEach((k, v) -> { if (v.getMappings() != null && !v.getMappings().isEmpty()) { Map<String, Object> bom = new LinkedHashMap<>(); v.getMappings().forEach((it) -> { String requirement = "Spring Boot " + it.determineVersionRangeRequirement(); bom.put(it.getVersion(), requirement); });// w ww .ja va2 s. c o m details.put(k, bom); } }); if (!details.isEmpty()) { builder.withDetail("bom-ranges", details); } }
From source file:org.openmhealth.shim.ShimRegistryImpl.java
public void init() { Map<String, Shim> registryMap = new LinkedHashMap<>(); for (Shim shim : shims) { if (shim.isConfigured()) { registryMap.put(shim.getShimKey(), shim); }/* ww w .j av a 2 s . c o m*/ } this.registryMap = registryMap; }
From source file:com.mapr.data.sputnik.JsonGenerator.java
public String testFlatJsonGenerator(String config) throws IOException { Map<String, Object> props = JSONConfigReader .readConfig(this.getClass().getClassLoader().getResourceAsStream(config), Map.class); Map<String, Object> wrapper = new LinkedHashMap<>(); wrapper.put(null, props);/*from w w w . j a va 2s . com*/ RandomJsonGenerator generator = new RandomJsonGenerator(wrapper); String json = generator.generateFlattnedJson(); return json; }