/** * @deprecated Deprecated as of 2.7.0. {@link Session} will not be a subclass of {@link HashMap} in future Play releases. */ @Deprecated @Override public String computeIfPresent(String key, BiFunction<? super String, ? super String, ? extends String> remappingFunction) { return super.computeIfPresent(key, remappingFunction); }
/** * @deprecated Deprecated as of 2.7.0. {@link Flash} will not be a subclass of {@link HashMap} in future Play releases. */ @Deprecated @Override public String computeIfPresent(String key, BiFunction<? super String, ? super String, ? extends String> remappingFunction) { return super.computeIfPresent(key, remappingFunction); }
/** * @deprecated Deprecated as of 2.7.0. {@link Flash} will not be a subclass of {@link HashMap} in future Play releases. */ @Deprecated @Override public String computeIfPresent(String key, BiFunction<? super String, ? super String, ? extends String> remappingFunction) { return super.computeIfPresent(key, remappingFunction); }
/** * @deprecated Deprecated as of 2.7.0. {@link Session} will not be a subclass of {@link HashMap} in future Play releases. */ @Deprecated @Override public String computeIfPresent(String key, BiFunction<? super String, ? super String, ? extends String> remappingFunction) { return super.computeIfPresent(key, remappingFunction); }
/** * @deprecated Deprecated as of 2.7.0. {@link Session} will not be a subclass of {@link HashMap} in future Play releases. */ @Deprecated @Override public String computeIfPresent(String key, BiFunction<? super String, ? super String, ? extends String> remappingFunction) { return super.computeIfPresent(key, remappingFunction); }
/** * @deprecated Deprecated as of 2.7.0. {@link Flash} will not be a subclass of {@link HashMap} in future Play releases. */ @Deprecated @Override public String computeIfPresent(String key, BiFunction<? super String, ? super String, ? extends String> remappingFunction) { return super.computeIfPresent(key, remappingFunction); }
private void testGetInstructorsForCourse() throws Exception { ______TS("success: get all instructors for a course"); String courseId = "idOfTypicalCourse1"; List<InstructorAttributes> instructors = instructorsLogic.getInstructorsForCourse(courseId); assertEquals(5, instructors.size()); HashMap<String, Boolean> idMap = new HashMap<>(); idMap.put("idOfInstructor1OfCourse1", false); idMap.put("idOfInstructor2OfCourse1", false); idMap.put("idOfInstructor3", false); for (InstructorAttributes i : instructors) { idMap.computeIfPresent(i.googleId, (key, value) -> true); } assertTrue(idMap.get("idOfInstructor1OfCourse1").booleanValue()); assertTrue(idMap.get("idOfInstructor2OfCourse1").booleanValue()); assertTrue(idMap.get("idOfInstructor3").booleanValue()); ______TS("failure: no instructors for a given course"); courseId = "new-course"; coursesLogic.createCourse(courseId, "New course", "UTC"); instructors = instructorsLogic.getInstructorsForCourse(courseId); assertEquals(0, instructors.size()); ______TS("failure: null parameters"); AssertionError ae = assertThrows(AssertionError.class, () -> instructorsLogic.getInstructorsForCourse(null)); AssertHelper.assertContains("Supplied parameter was null", ae.getMessage()); }
@Override public String computeIfPresent(String key, BiFunction<? super String, ? super String, ? extends String> remappingFunction) { return map.computeIfPresent(key, remappingFunction); }
@Override public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) { return map.computeIfPresent(key, remappingFunction); }
void removeModifiedTuple(ModifiedTuple mt){ modifiedTuples.computeIfPresent(mt.oldtuple.rid, (rid, list) -> { list.remove(mt); return list.isEmpty() ? null : list; }); } }
@Override public V computeIfPresent(String key, BiFunction<? super String, ? super V, ? extends V> remappingFunction) { return super.computeIfPresent(safeToLower(key), remappingFunction); }
private List<Integer> reorderBooks(final List<Integer> books) { // Counting how often a book number appears in the basket list HashMap<Integer, Integer> numberCount = new HashMap<>(); for (Integer book : books) { numberCount.computeIfPresent(book, (key, value) -> value + 1); numberCount.putIfAbsent(book, 1); } return books.stream() .sorted((bookNumberOne, bookNumberTwo) -> { Integer countOne = numberCount.get(bookNumberOne); Integer countTwo = numberCount.get(bookNumberTwo); // Books whose numbers appear more often should be in front of the basket list if (countOne > countTwo) { return -1; } else if (countOne.equals(countTwo)) { return 0; } else { return 1; } }) .collect(Collectors.toList()); }
@Override public void merge(String streamSegmentName, long dataLength, int numOfEvents, long txnCreationTime) { segments.computeIfPresent(streamSegmentName, (x, y) -> { y.addAndGet(numOfEvents); return y; }); } }
@Override public void record(String streamSegmentName, long dataLength, int numOfEvents) { segments.computeIfPresent(streamSegmentName, (x, y) -> { y.addAndGet(numOfEvents); return y; }); }
@Override public void handleIncomingMessage(Dpid dpid, OFMessage msg) { if (msg.getType() == OFType.PACKET_IN || msg.getType() == OFType.FLOW_MOD || msg.getType() == OFType.STATS_REPLY) { aggregators.computeIfPresent(dpid, (k, v) -> { v.increment(msg); return v; }); } }
@Override public void handleOutgoingMessage(Dpid dpid, List<OFMessage> msgs) { for (OFMessage msg : msgs) { if (msg.getType() == OFType.PACKET_OUT || msg.getType() == OFType.FLOW_MOD || msg.getType() == OFType.STATS_REQUEST) { aggregators.computeIfPresent(dpid, (k, v) -> { v.increment(msg); return v; }); } } } }