List of usage examples for java.util SortedMap get
V get(Object key);
From source file:co.rsk.remasc.RemascStorageProviderTest.java
@Test public void setSaveRetrieveAndGetManySiblings() throws IOException { String accountAddress = randomAddress(); Repository repository = new RepositoryImplForTesting(); RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress); Block genesis = BlockGenerator.getGenesisBlock(); Block block1 = BlockGenerator.createChildBlock(genesis); Block block2 = BlockGenerator.createChildBlock(block1); Block block3 = BlockGenerator.createChildBlock(block2); Block block4 = BlockGenerator.createChildBlock(block3); Block block5 = BlockGenerator.createChildBlock(block4); Sibling sibling1 = new Sibling(genesis.getHeader(), genesis.getCoinbase(), 1); Sibling sibling2 = new Sibling(block1.getHeader(), block1.getCoinbase(), 2); Sibling sibling3 = new Sibling(block2.getHeader(), block2.getCoinbase(), 3); Sibling sibling4 = new Sibling(block3.getHeader(), block3.getCoinbase(), 4); Sibling sibling5 = new Sibling(block4.getHeader(), block4.getCoinbase(), 5); Sibling sibling6 = new Sibling(block5.getHeader(), block5.getCoinbase(), 6); List<Sibling> siblings0 = new ArrayList<>(); List<Sibling> siblings1 = new ArrayList<>(); List<Sibling> siblings2 = new ArrayList<>(); siblings0.add(sibling1);/*www . j av a2 s . co m*/ siblings0.add(sibling2); siblings1.add(sibling3); siblings1.add(sibling4); siblings2.add(sibling5); siblings2.add(sibling6); provider.getSiblings().put(Long.valueOf(0), siblings0); provider.getSiblings().put(Long.valueOf(1), siblings1); provider.getSiblings().put(Long.valueOf(2), siblings2); provider.save(); RemascStorageProvider newProvider = new RemascStorageProvider(repository, accountAddress); SortedMap<Long, List<Sibling>> map = newProvider.getSiblings(); Assert.assertNotNull(map); Assert.assertFalse(map.isEmpty()); Assert.assertTrue(map.containsKey(Long.valueOf(0))); Assert.assertTrue(map.containsKey(Long.valueOf(1))); Assert.assertTrue(map.containsKey(Long.valueOf(2))); Assert.assertEquals(2, map.get(Long.valueOf(0)).size()); Assert.assertEquals(2, map.get(Long.valueOf(1)).size()); Assert.assertEquals(2, map.get(Long.valueOf(2)).size()); List<Sibling> list0 = map.get(Long.valueOf(0)); List<Sibling> list1 = map.get(Long.valueOf(1)); List<Sibling> list2 = map.get(Long.valueOf(2)); Assert.assertEquals(1, list0.get(0).getIncludedHeight()); Assert.assertArrayEquals(genesis.getHeader().getHash(), list0.get(0).getHash()); Assert.assertEquals(2, list0.get(1).getIncludedHeight()); Assert.assertArrayEquals(block1.getHeader().getHash(), list0.get(1).getHash()); Assert.assertEquals(3, list1.get(0).getIncludedHeight()); Assert.assertArrayEquals(block2.getHeader().getHash(), list1.get(0).getHash()); Assert.assertEquals(4, list1.get(1).getIncludedHeight()); Assert.assertArrayEquals(block3.getHeader().getHash(), list1.get(1).getHash()); Assert.assertEquals(5, list2.get(0).getIncludedHeight()); Assert.assertArrayEquals(block4.getHeader().getHash(), list2.get(0).getHash()); Assert.assertEquals(6, list2.get(1).getIncludedHeight()); Assert.assertArrayEquals(block5.getHeader().getHash(), list2.get(1).getHash()); }
From source file:org.gvnix.web.screen.roo.addon.RelatedPatternMetadataProvider.java
/** * Return an instance of the Metadata offered by this add-on. *//* w w w .j a v a 2 s.co m*/ @Override protected ItdTypeDetailsProvidingMetadataItem getMetadata(String mid, JavaType aspect, PhysicalTypeMetadata controllerMetadata, String file) { // We need to parse the annotation, which we expect to be present WebScaffoldAnnotationValues annotationValues = new WebScaffoldAnnotationValues(controllerMetadata); if (!annotationValues.isAnnotationFound() || annotationValues.getFormBackingObject() == null || controllerMetadata.getMemberHoldingTypeDetails() == null) { return null; } // Get controller java type from its metadata identification JavaType controllerType = RelatedPatternMetadata.getJavaType(mid); // We need to know the metadata of the Controller through // WebScaffoldMetada LogicalPath path = RelatedPatternMetadata.getPath(mid); String webScaffoldMetadataKey = WebScaffoldMetadata.createIdentifier(controllerType, path); WebScaffoldMetadata webScaffoldMetadata = (WebScaffoldMetadata) getMetadataService() .get(webScaffoldMetadataKey); if (webScaffoldMetadata == null) { // The pattern can not be defined over a Controller without // @RooWebScaffold annotation return null; } // We know governor type details are non-null and can be safely cast ClassOrInterfaceTypeDetails controllerTypeDetails = (ClassOrInterfaceTypeDetails) controllerMetadata .getMemberHoldingTypeDetails(); Validate.notNull(controllerTypeDetails, "Governor failed to provide class type details, in violation of superclass contract"); // Check if there are pattern names used more than once in project Validate.isTrue(!getPatternService().existsMasterPatternDuplicated(), "There is a pattern name used more than once in the project"); // Get pattern attributes of the controller List<StringAttributeValue> patternList = getPatternService() .getControllerRelatedPatternsValueAttributes(controllerType); // Lookup the form backing object's metadata and check that JavaType entity = annotationValues.getFormBackingObject(); // Get and validate required details and metadatas PhysicalTypeMetadata entityMetadata = (PhysicalTypeMetadata) getMetadataService().get( PhysicalTypeIdentifier.createIdentifier(entity, LogicalPath.getInstance(Path.SRC_MAIN_JAVA, ""))); Validate.notNull(entityMetadata, "Unable to obtain physical type metadata for type " + entity.getFullyQualifiedTypeName()); MemberDetails entityDetails = getMemberDetails(entityMetadata); MemberHoldingTypeDetails entityPersistentDetails = MemberFindingUtils .getMostConcreteMemberHoldingTypeDetailsWithTag(entityDetails, CustomDataKeys.PERSISTENT_TYPE); SortedMap<JavaType, JavaTypeMetadataDetails> relatedEntities = getWebMetadataService() .getRelatedApplicationTypeMetadata(entity, entityDetails, mid); if (entityPersistentDetails == null || relatedEntities == null || relatedEntities.get(entity) == null || relatedEntities.get(entity).getPersistenceDetails() == null) { return null; } // Remember that this entity JavaType matches up with this metadata // identification string // Start by clearing the previous association // Working in the same way as WebScaffoldMetadataProvider JavaType oldEntity = webScaffoldMidToEntityMap.get(mid); if (oldEntity != null) { entityToWebScaffoldMidMap.remove(oldEntity); } entityToWebScaffoldMidMap.put(entity, mid); webScaffoldMidToEntityMap.put(mid, entity); MemberDetails controllerDetails = getMemberDetails(controllerMetadata); Map<JavaSymbolName, DateTimeFormatDetails> entityDateTypes = getWebMetadataService().getDatePatterns(entity, entityDetails, mid); // Install Dialog Bean OperationUtils.installWebDialogClass(aspect.getPackage().getFullyQualifiedPackageName().concat(".dialog"), getProjectOperations().getPathResolver(), getFileManager()); // Related fields and dates SortedMap<JavaType, JavaTypeMetadataDetails> relatedFields = getRelationFieldsDetails(mid, controllerMetadata, entity, getWebMetadataService()); Map<JavaType, Map<JavaSymbolName, DateTimeFormatDetails>> relatedDates = getRelationFieldsDateFormat(mid, controllerMetadata, entity, getWebMetadataService()); // Get master entity, if not exists nothing to do JavaType masterEntity = getMasterEntity(entity, relatedEntities); if (masterEntity == null) { return null; } JavaTypeMetadataDetails masterEntityJavaDetails = relatedEntities.get(masterEntity); // Get entity fields names defined into relations pattern annotation on // its related controller List<String> relationsFields = getPatternService().getEntityRelationsPatternsFields(masterEntity); // Get master entity details MemberDetails masterEntityDetails = getMemberDetails(masterEntity); // Pass dependencies required by the metadata in through its constructor return new RelatedPatternMetadata(mid, aspect, controllerMetadata, controllerDetails, webScaffoldMetadata, patternList, entityMetadata, entityDetails, masterEntityJavaDetails, masterEntityDetails, relationsFields, relatedEntities, relatedFields, relatedDates, entityDateTypes); }
From source file:com.jxt.web.service.AgentInfoServiceImpl.java
@Override public ApplicationAgentList getApplicationAgentList(ApplicationAgentList.Key applicationAgentListKey, String applicationName, long timestamp) { if (applicationName == null) { throw new NullPointerException("applicationName must not be null"); }/* w w w.j a va 2 s. c om*/ if (applicationAgentListKey == null) { throw new NullPointerException("applicationAgentListKey must not be null"); } final List<String> agentIdList = this.applicationIndexDao.selectAgentIds(applicationName); if (logger.isDebugEnabled()) { logger.debug("agentIdList={}", agentIdList); } if (CollectionUtils.isEmpty(agentIdList)) { logger.debug("agentIdList is empty. applicationName={}", applicationName); return new ApplicationAgentList(new TreeMap<String, List<AgentInfo>>()); } // key = hostname // value= list fo agentinfo SortedMap<String, List<AgentInfo>> result = new TreeMap<>(); List<AgentInfo> agentInfos = this.agentInfoDao.getAgentInfos(agentIdList, timestamp); this.agentLifeCycleDao.populateAgentStatuses(agentInfos, timestamp); for (AgentInfo agentInfo : agentInfos) { if (agentInfo != null) { String hostname = applicationAgentListKey.getKey(agentInfo); if (result.containsKey(hostname)) { result.get(hostname).add(agentInfo); } else { List<AgentInfo> list = new ArrayList<>(); list.add(agentInfo); result.put(hostname, list); } } } for (List<AgentInfo> agentInfoList : result.values()) { Collections.sort(agentInfoList, AgentInfo.AGENT_NAME_ASC_COMPARATOR); } logger.info("getApplicationAgentList={}", result); return new ApplicationAgentList(result); }
From source file:se.jguru.nazgul.tools.codestyle.enforcer.rules.CorrectPackagingRule.java
/** * Adds all source file found by recursive search under sourceRoot to the * toPopulate List, using a width-first approach. * * @param fileOrDirectory The file or directory to search for packages and [if a directory] recursively * search for further source files. * @param package2FileNamesMap A Map relating package names extracted by the PackageExtractors. *//*from www.jav a 2 s . c om*/ private void addPackages(final File fileOrDirectory, final SortedMap<String, SortedSet<String>> package2FileNamesMap) { for (PackageExtractor current : packageExtractors) { final FileFilter sourceFileDefinitionFilter = current.getSourceFileFilter(); if (fileOrDirectory.isFile() && sourceFileDefinitionFilter.accept(fileOrDirectory)) { // Single source file to add. final String thePackage = current.getPackage(fileOrDirectory); SortedSet<String> sourceFileNames = package2FileNamesMap.get(thePackage); if (sourceFileNames == null) { sourceFileNames = new TreeSet<String>(); package2FileNamesMap.put(thePackage, sourceFileNames); } // Done. sourceFileNames.add(fileOrDirectory.getName()); } else if (fileOrDirectory.isDirectory()) { // Add the immediate source files for (File currentChild : fileOrDirectory.listFiles(sourceFileDefinitionFilter)) { addPackages(currentChild, package2FileNamesMap); } // Recurse into subdirectories for (File currentSubdirectory : fileOrDirectory.listFiles(DIRECTORY_FILTER)) { addPackages(currentSubdirectory, package2FileNamesMap); } } } }
From source file:net.sourceforge.fenixedu.presentationTier.Action.administrativeOffice.student.RegistrationDA.java
public ActionForward viewAttends(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) {//from w ww .ja v a2s. c o m RenderUtils.invalidateViewState(); final Registration registration = getAndSetRegistration(request); request.setAttribute("registration", registration); if (registration != null) { final SortedMap<ExecutionSemester, SortedSet<Attends>> attendsMap = new TreeMap<ExecutionSemester, SortedSet<Attends>>(); for (final Attends attends : registration.getAssociatedAttendsSet()) { final ExecutionSemester executionSemester = attends.getExecutionPeriod(); SortedSet<Attends> attendsSet = attendsMap.get(executionSemester); if (attendsSet == null) { attendsSet = new TreeSet<Attends>(Attends.ATTENDS_COMPARATOR); attendsMap.put(executionSemester, attendsSet); } attendsSet.add(attends); } request.setAttribute("attendsMap", attendsMap); } return mapping.findForward("viewAttends"); }
From source file:com.palantir.atlasdb.transaction.impl.SerializableTransaction.java
private void verifyRows(Transaction ro) { for (String table : rowsRead.keySet()) { final ConcurrentNavigableMap<Cell, byte[]> readsForTable = getReadsForTable(table); Multimap<ColumnSelection, byte[]> map = Multimaps.newSortedSetMultimap( Maps.<ColumnSelection, Collection<byte[]>>newHashMap(), new Supplier<SortedSet<byte[]>>() { @Override//from www. ja v a 2 s.c om public TreeSet<byte[]> get() { return Sets.newTreeSet(UnsignedBytes.lexicographicalComparator()); } }); for (RowRead r : rowsRead.get(table)) { map.putAll(r.cols, r.rows); } for (final ColumnSelection cols : map.keySet()) { for (List<byte[]> batch : Iterables.partition(map.get(cols), 1000)) { SortedMap<byte[], RowResult<byte[]>> currentRows = ro.getRows(table, batch, cols); for (byte[] row : batch) { RowResult<byte[]> currentRow = currentRows.get(row); Map<Cell, byte[]> orignalReads = readsForTable .tailMap(Cells.createSmallestCellForRow(row), true) .headMap(Cells.createLargestCellForRow(row), true); // We want to filter out all our reads to just the set that matches our column selection. orignalReads = Maps.filterKeys(orignalReads, new Predicate<Cell>() { @Override public boolean apply(Cell input) { return cols.contains(input.getColumnName()); } }); if (writesByTable.get(table) != null) { // We don't want to verify any reads that we wrote to cause we will just read our own values. // NB: We filter our write set out here because our normal SI checking handles this case to ensure the value hasn't changed. orignalReads = Maps.filterKeys(orignalReads, Predicates.not(Predicates.in(writesByTable.get(table).keySet()))); } if (currentRow == null && orignalReads.isEmpty()) { continue; } if (currentRow == null) { throw TransactionSerializableConflictException.create(table, getTimestamp(), System.currentTimeMillis() - timeCreated); } Map<Cell, byte[]> currentCells = Maps2.fromEntries(currentRow.getCells()); if (writesByTable.get(table) != null) { // We don't want to verify any reads that we wrote to cause we will just read our own values. // NB: We filter our write set out here because our normal SI checking handles this case to ensure the value hasn't changed. currentCells = Maps.filterKeys(currentCells, Predicates.not(Predicates.in(writesByTable.get(table).keySet()))); } if (!areMapsEqual(orignalReads, currentCells)) { throw TransactionSerializableConflictException.create(table, getTimestamp(), System.currentTimeMillis() - timeCreated); } } } } } }
From source file:org.cloudifysource.restDoclet.generation.Generator.java
private static SortedMap<String, DocMethod> generateMethods(final MethodDoc[] methods) throws Exception { SortedMap<String, DocMethod> docMethods = new TreeMap<String, DocMethod>(); for (MethodDoc methodDoc : methods) { List<DocAnnotation> annotations = generateAnnotations(methodDoc.annotations()); // Does not handle methods without a RequestMapping annotation. if (Utils.filterOutMethod(methodDoc, annotations)) { continue; }// w w w . j a v a2 s .c o m // get all HTTP methods DocRequestMappingAnnotation requestMappingAnnotation = Utils.getRequestMappingAnnotation(annotations); String[] methodArray = requestMappingAnnotation.getMethod(); DocHttpMethod[] docHttpMethodArray = new DocHttpMethod[methodArray.length]; for (int i = 0; i < methodArray.length; i++) { docHttpMethodArray[i] = generateHttpMethod(methodDoc, methodArray[i], annotations); } // get all URIs String[] uriArray = requestMappingAnnotation.getValue(); if (uriArray == null || uriArray.length == 0) { uriArray = new String[1]; uriArray[0] = ""; } for (String uri : uriArray) { DocMethod docMethod = docMethods.get(uri); // If method with that uri already exist, // add the current httpMethod to the existing method. // There can be several httpMethods (GET, POST, DELETE) for each // uri. if (docMethod != null) { docMethod.addHttpMethods(docHttpMethodArray); } else { docMethod = new DocMethod(docHttpMethodArray); docMethod.setUri(uri); } docMethods.put(uri, docMethod); } } return docMethods; }
From source file:com.aurel.track.report.dashboard.StatusOverTimeGraph.java
/** * Computes the hierarchical data for status changes * @return//from w w w. ja va 2 s. com */ public static SortedMap<Integer, SortedMap<Integer, Map<Integer, Integer>>> calculateStatus(int[] workItemIDs, Date dateFrom, Date dateTo, List<Integer> statusIDs, int selectedTimeInterval, Locale locale) { SortedMap<Integer, SortedMap<Integer, Map<Integer, Integer>>> yearToPeriodToStatusIDToStatusNumbersMap = new TreeMap<Integer, SortedMap<Integer, Map<Integer, Integer>>>(); if (statusIDs != null && statusIDs.isEmpty()) { LOGGER.debug("No status specified"); return yearToPeriodToStatusIDToStatusNumbersMap; } if (workItemIDs == null || workItemIDs.length == 0) { // LOGGER.warn("No issues satisfy the filtering condition (read right revoked, project/release deleted?)"); return yearToPeriodToStatusIDToStatusNumbersMap; } List<HistorySelectValues> historySelectValuesList = HistoryTransactionBL.getByWorkItemsFieldNewValuesDates( workItemIDs, SystemFields.INTEGER_STATE, statusIDs, dateFrom, dateTo); SortedMap<Integer, SortedMap<Integer, List<HistorySelectValues>>> periodStatusChanges = getStatusChangesMap( historySelectValuesList, selectedTimeInterval, false/*, statusIDs*/); Iterator<Integer> yearIterator = periodStatusChanges.keySet().iterator(); while (yearIterator.hasNext()) { Integer year = yearIterator.next(); SortedMap<Integer, List<HistorySelectValues>> intervalToStatusChangeBeans = periodStatusChanges .get(year); Iterator<Integer> periodIterator = intervalToStatusChangeBeans.keySet().iterator(); while (periodIterator.hasNext()) { Integer period = periodIterator.next(); List<HistorySelectValues> statusChangeBeansForInterval = intervalToStatusChangeBeans.get(period); if (statusChangeBeansForInterval != null) { Iterator statusChangeBeansIterator = statusChangeBeansForInterval.iterator(); while (statusChangeBeansIterator.hasNext()) { HistorySelectValues stateChangeBean = (HistorySelectValues) statusChangeBeansIterator .next(); Integer statusID = stateChangeBean.getNewValue(); setCount(yearToPeriodToStatusIDToStatusNumbersMap, year, period, statusID, 1); } } } } addZerosForEmptyIntervals(dateFrom, dateTo, selectedTimeInterval, yearToPeriodToStatusIDToStatusNumbersMap, statusIDs); //addTimeSeries(timeSeriesCollection, yearToPeriodToStatusIDToStatusNumbersMap, statusMap, selectedTimeInterval, accumulated); return yearToPeriodToStatusIDToStatusNumbersMap; }
From source file:org.kuali.kra.budget.external.budget.impl.BudgetAdjustmentServiceHelperImpl.java
public SortedMap<RateType, ScaleTwoDecimal> getNonPersonnelCalculatedDirectCost(Budget currentBudget, AwardBudgetExt previousBudget) { SortedMap<RateType, List<ScaleTwoDecimal>> currentNonPersonnelCalcDirectCost = currentBudget .getNonPersonnelCalculatedExpenseTotals(); SortedMap<RateType, ScaleTwoDecimal> netNonPersonnelCalculatedDirectCost = new TreeMap<RateType, ScaleTwoDecimal>(); int period = currentBudget.getBudgetPeriods().size() - 1; for (RateType rateType : currentNonPersonnelCalcDirectCost.keySet()) { List<ScaleTwoDecimal> currentExpenses = currentNonPersonnelCalcDirectCost.get(rateType); netNonPersonnelCalculatedDirectCost.put(rateType, currentExpenses.get(period)); }//from w w w.jav a 2 s.c o m return netNonPersonnelCalculatedDirectCost; }
From source file:playground.sergioo.workplaceCapacities2012.MainWorkplaceCapacities.java
private static Map<String, PointPerson> getWorkActivityTimes() throws IOException, InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException, NoConnectionException { DataBaseAdmin dataBaseHits = new DataBaseAdmin(new File("./data/hits/DataBase.properties")); Map<String, PersonSchedule> times; ResultSet timesResult = dataBaseHits.executeQuery( "SELECT pax_idx,trip_id,t6_purpose,t3_starttime,t4_endtime,p6_occup,t5_placetype FROM hits.hitsshort"); times = new HashMap<String, PersonSchedule>(); while (timesResult.next()) { PersonSchedule timesPerson = times.get(timesResult.getString(1)); if (timesPerson == null) { timesPerson = new PersonSchedule(timesResult.getString(1), timesResult.getString(6)); times.put(timesResult.getString(1), timesPerson); }/*from www . j a va 2 s . co m*/ if (timesResult.getInt(2) != 0) { Iterator<Entry<Integer, Trip>> timesPersonI = timesPerson.getTrips().entrySet().iterator(); Entry<Integer, Trip> last = null; while (timesPersonI.hasNext()) last = timesPersonI.next(); if (last == null || last.getKey() != timesResult.getInt(2)) { int startTime = (timesResult.getInt(4) % 100) * 60 + (timesResult.getInt(4) / 100) * 3600; int endTime = (timesResult.getInt(5) % 100) * 60 + (timesResult.getInt(5) / 100) * 3600; if (last != null && last.getKey() < timesResult.getInt(2) && last.getValue().getEndTime() > startTime) { startTime += 12 * 3600; endTime += 12 * 3600; } if (last != null && last.getKey() < timesResult.getInt(2) && last.getValue().getEndTime() > startTime) { startTime += 12 * 3600; endTime += 12 * 3600; } timesPerson.getTrips().put(timesResult.getInt(2), new Trip(timesResult.getString(3), startTime, endTime, timesResult.getString(7))); } } } timesResult.close(); Map<String, PointPerson> points = new HashMap<String, PointPerson>(); for (PersonSchedule timesPerson : times.values()) { SortedMap<Integer, Trip> tripsPerson = timesPerson.getTrips(); boolean startTimeSaved = false; double startTime = -1, endTime = -1; String placeType = null; if (tripsPerson.size() > 0) { for (int i = tripsPerson.keySet().iterator().next(); i <= tripsPerson.size(); i++) { if (!startTimeSaved && tripsPerson.get(i).getPurpose() != null && tripsPerson.get(i).getPurpose().equals("work")) { startTime = tripsPerson.get(i).getEndTime(); startTimeSaved = true; } if (i > tripsPerson.keySet().iterator().next() && tripsPerson.get(i - 1).getPurpose().equals("work")) { endTime = tripsPerson.get(i).getStartTime(); placeType = tripsPerson.get(i - 1).getPlaceType(); } } } if (startTime != -1 && endTime != -1 && endTime - startTime >= 7 * 3600 && endTime - startTime <= 16 * 3600) if (startTime > 24 * 3600) points.put(timesPerson.getId(), new PointPerson( timesPerson.getId(), timesPerson.getOccupation(), new Double[] { startTime - 24 * 3600, endTime - 24 * 3600 - (startTime - 24 * 3600) }, placeType)); else points.put(timesPerson.getId(), new PointPerson(timesPerson.getId(), timesPerson.getOccupation(), new Double[] { startTime, endTime - startTime }, placeType)); } Map<String, Double> weights; try { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(WEIGHTS2_MAP_FILE)); weights = (Map<String, Double>) ois.readObject(); ois.close(); } catch (EOFException e) { weights = new HashMap<String, Double>(); ResultSet weightsR = dataBaseHits.executeQuery("SELECT pax_idx,hipf10 FROM hits.hitsshort_geo_hipf"); while (weightsR.next()) weights.put(weightsR.getString(1), weightsR.getDouble(2)); for (PointPerson pointPerson : points.values()) { if (weights.get(pointPerson.getId()) != null) pointPerson.setWeight(weights.get(pointPerson.getId())); else pointPerson.setWeight(100); } ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(WEIGHTS2_MAP_FILE)); oos.writeObject(weights); oos.close(); } dataBaseHits.close(); return points; }