Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. public class Test{
  2.  
  3.     private static Map<String, Boolean> finalMap = new HashMap<>();
  4.  
  5.     private static void createReport(int searchDepth, String prevKey, List<HRBOPresenceStatus> onlineStatuses) {
  6.         Map<String, List<HRBOPresenceStatus>> map = new HashMap<>();
  7.         for (HRBOPresenceStatus status : onlineStatuses) {
  8.             String key = prevKey.length() > 0 ? prevKey + ", " + status.getValue(searchDepth) : status.getValue(searchDepth);
  9.             if (map.get(key) == null) {
  10.                 List<HRBOPresenceStatus> list = new ArrayList<>();
  11.                 list.add(status);
  12.                 map.put(key, list);
  13.             } else {
  14.                 map.get(key).add(status);
  15.             }
  16.         }
  17.  
  18.         for (Map.Entry<String, List<HRBOPresenceStatus>> entry : map.entrySet()) {
  19.             if (entry.getValue().size() != 1) {
  20.                 createReport(searchDepth + 1, entry.getKey(), entry.getValue());
  21.             } else {
  22.                 finalMap.put(entry.getKey(), entry.getValue().get(0).isOnline());
  23.             }
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement