### Question:
MonitorServiceImpl implements MonitorService { @Override public List<MonitorBean> getAll(String app, String id) { if (app == null || id == null) { throw new TicketServerException(ResultEnum.ERROR); } Set<String> pres = template.keys(MonitorService.getMonitorPreKeys(app, id)); if (pres == null) { throw new TicketServerException(ResultEnum.ERROR); } Map<String, MonitorBean> map = new HashMap<>(); pres.forEach(s -> { String pre = opsForValue.get(s); MonitorBean monitorBean = new MonitorBean(); monitorBean.setApp(app); monitorBean.setId(id); monitorBean.setPre(Integer.parseInt(pre == null ? String.valueOf(0) : pre)); String after = opsForValue.get(s.replace(PRE, AFTER)); monitorBean.setAfter(Integer.parseInt(after == null ? String.valueOf(0) : after)); monitorBean.setLocalDateTime(DateTimeUtil.parse(s.substring(s.lastIndexOf(MonitorService.DATE) + MonitorService.DATE.length()))); if (map.containsKey(monitorBean.getDateTime())) { monitorBean.setPre(monitorBean.getPre() + map.get(monitorBean.getDateTime()).getPre()); monitorBean.setAfter(monitorBean.getAfter() + map.get(monitorBean.getDateTime()).getAfter()); } map.put(monitorBean.getDateTime(), monitorBean); }); return new ArrayList<>(map.values()); }  @Override void save(List<MonitorBean> monitorBeans); @Override List<MonitorBean> getAll(String app, String id); @Override boolean clean(String app, String id);  }### Answer:
@Test public void getAll() { String s1 = "sa$aaa$PRE$aa$a"; System.out.println(s1.replace("$PRE$","$AFTER$")); }