List of usage examples for org.springframework.util LinkedMultiValueMap entrySet
@Override
public Set<Entry<K, List<V>>> entrySet()
From source file:org.pad.pgsql.loadmovies.LoadFiles.java
/** * Load ratings and enrich movies with tags informations before updating the related movie. * * @throws Exception//w w w. j a va 2 s. c o m */ private static void loadRatings() throws Exception { //MultivalueMap with key movieId and values all tags LinkedMultiValueMap<Integer, Tag> tags = readTags(); //MultivalueMap with key movieId and values all ratings LinkedMultiValueMap<Integer, Rating> ratings = new LinkedMultiValueMap(); //"userId,movieId,rating,timestamp final Reader reader = new FileReader("C:\\PRIVE\\SRC\\ml-20m\\ratings.csv"); CSVParser parser = new CSVParser(reader, CSVFormat.EXCEL.withHeader()); RatingDao ratingDao = new RatingDao(DS); for (CSVRecord record : parser) { Integer movieId = Integer.parseInt(record.get("movieId")); Integer userId = Integer.parseInt(record.get("userId")); if (keepId(movieId) && keepId(userId)) { //Building a rating object. Rating rating = new Rating(); rating.setUserId(userId); rating.setMovieId(movieId); rating.setRating(Float.parseFloat(record.get("rating"))); rating.setDate(new Date(Long.parseLong(record.get("timestamp")) * 1000)); //Add for json saving ratings.add(rating.getMovieId(), rating); //traditional saving //ratingDao.save(rating); } } MovieDaoJSON movieDaoJSON = new MovieDaoJSON(DS); ratings.entrySet().stream().forEach((integerListEntry -> { //Building other information objects OtherInformations otherInformations = new OtherInformations(); List ratingList = integerListEntry.getValue(); otherInformations.setRatings(ratingList.subList(0, Math.min(10, ratingList.size()))); otherInformations.computeMean(); //Retrieve tags from the movieId otherInformations.setTags(tags.get(integerListEntry.getKey())); try { movieDaoJSON.addOtherInformationsToMovie(integerListEntry.getKey(), otherInformations); } catch (JsonProcessingException e) { e.printStackTrace(); } })); }
From source file:com.iflytek.edu.cloud.frame.web.filter.CheckOpenServiceFilter.java
@SuppressWarnings("unchecked") @Override//from w w w . j a va 2 s .co m public void afterPropertiesSet() throws Exception { LOGGER.info("??RequestMappingHandlerMapping?RequestMappingInfo?"); Field urlMapField = AbstractHandlerMethodMapping.class.getDeclaredField("urlMap"); urlMapField.setAccessible(true); LinkedMultiValueMap<String, ServiceMethodInfo> urlMap = (LinkedMultiValueMap<String, ServiceMethodInfo>) urlMapField .get(handlerMapping); for (Entry<String, List<ServiceMethodInfo>> entry : urlMap.entrySet()) { List<ServiceMethodInfo> mapping = entry.getValue(); for (ServiceMethodInfo mappingInfo : mapping) { methodVersionMap.put(entry.getKey(), mappingInfo.getServiceMethodCondition().getVersion()); } } }