@Test public void addEvent() { Map<TrackEventType, List<String>> trackUrls = new EnumMap<>(TrackEventType.class); OrtbUtils.addEvent(trackUrls, TrackEventType.MediationWin, null); OrtbUtils.addEvent(trackUrls, TrackEventType.MediationWin, ""); OrtbUtils.addEvent(trackUrls, TrackEventType.MediationWin, "test_url_win"); OrtbUtils.addEvent(trackUrls, TrackEventType.MediationLoss, "test_url_loss"); assertEquals(2, trackUrls.size()); List<String> urlList = trackUrls.get(TrackEventType.MediationWin); assertNotNull(urlList); assertEquals(1, urlList.size()); assertEquals("test_url_win", urlList.get(0)); urlList = trackUrls.get(TrackEventType.MediationLoss); assertNotNull(urlList); assertEquals(1, urlList.size()); assertEquals("test_url_loss", urlList.get(0)); urlList = trackUrls.get(TrackEventType.Load); assertNull(urlList); }
static void addEvent(@NonNull Map<TrackEventType, List<String>> outMap, @NonNull TrackEventType eventType, @Nullable String url) { if (TextUtils.isEmpty(url)) { return; } List<String> urlList = outMap.get(eventType); if (urlList == null) { urlList = new ArrayList<>(1); outMap.put(eventType, urlList); } urlList.add(url); }
OrtbUtils { static void addEvent(@NonNull Map<TrackEventType, List<String>> outMap, @NonNull TrackEventType eventType, @Nullable String url) { if (TextUtils.isEmpty(url)) { return; } List<String> urlList = outMap.get(eventType); if (urlList == null) { urlList = new ArrayList<>(1); outMap.put(eventType, urlList); } urlList.add(url); } }
OrtbUtils { static void addEvent(@NonNull Map<TrackEventType, List<String>> outMap, @NonNull TrackEventType eventType, @Nullable String url) { if (TextUtils.isEmpty(url)) { return; } List<String> urlList = outMap.get(eventType); if (urlList == null) { urlList = new ArrayList<>(1); outMap.put(eventType, urlList); } urlList.add(url); }  }
OrtbUtils { static void addEvent(@NonNull Map<TrackEventType, List<String>> outMap, @NonNull TrackEventType eventType, @Nullable String url) { if (TextUtils.isEmpty(url)) { return; } List<String> urlList = outMap.get(eventType); if (urlList == null) { urlList = new ArrayList<>(1); outMap.put(eventType, urlList); } urlList.add(url); }   }
OrtbUtils { static void addEvent(@NonNull Map<TrackEventType, List<String>> outMap, @NonNull TrackEventType eventType, @Nullable String url) { if (TextUtils.isEmpty(url)) { return; } List<String> urlList = outMap.get(eventType); if (urlList == null) { urlList = new ArrayList<>(1); outMap.put(eventType, urlList); } urlList.add(url); }    }