Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test{
- private static Map<String, Boolean> finalMap = new HashMap<>();
- private static void createReport(int searchDepth, String prevKey, List<HRBOPresenceStatus> onlineStatuses) {
- Map<String, List<HRBOPresenceStatus>> map = new HashMap<>();
- for (HRBOPresenceStatus status : onlineStatuses) {
- String key = prevKey.length() > 0 ? prevKey + ", " + status.getValue(searchDepth) : status.getValue(searchDepth);
- if (map.get(key) == null) {
- List<HRBOPresenceStatus> list = new ArrayList<>();
- list.add(status);
- map.put(key, list);
- } else {
- map.get(key).add(status);
- }
- }
- for (Map.Entry<String, List<HRBOPresenceStatus>> entry : map.entrySet()) {
- if (entry.getValue().size() != 1) {
- createReport(searchDepth + 1, entry.getKey(), entry.getValue());
- } else {
- finalMap.put(entry.getKey(), entry.getValue().get(0).isOnline());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement