EPLUtilities { @SuppressWarnings("unchecked") public static Map<String, Object> findIntersection(Object set1, Object set2) { if (set1 instanceof Map && set2 instanceof Map) { return findIntersectionMap((Map<String, Object>) set1, (Map<String, Object>) set2); } return null; }  static List<T> arrayToList(T[] array); static Double castToDouble(Object object); static Double[] castToDoubleArray(Object[] array); static Integer castToInteger(Object object); static Integer[] castToIntegerArray(Object[] array); static Long castToLong(Object object); static Long[] castToLongArray(Object[] array); static String castToString(Object object); static String[] castToStringArray(Object[] array); @SuppressWarnings("unchecked") static Map<String, Object> findIntersection(Object set1, Object set2); static Map<String, Object> findIntersectionMap(Map<String, Object> set1, Map<String, Object> set2); static Double generateRandomDouble(Object key); static T getArrayElement(T[] array, int at); static Object getAttribute(Object object, String key); @Deprecated static Double getAttributeDoubleValue(List<Map<String, String>> attributes, String name); static Object getAttributeValue(List<Map<String, String>> attributes, String name); @SuppressWarnings("unchecked") static Object getAttributeValue(Map<String, Object> attrs, String name); static List getAttributeValues(List<Map<String, String>> attributes, String name); static int getCollectionSize(Collection<?> collection); static String getCurrentDateInISO8601Format(Object key); static Date getDateFromISO8601(Object iso8601); static Date getDateFromRFC822String(Object rfc822); static T getListElement(List<T> list, int at); static Long getMillisFromISO8601(Object iso8601); static Long getMillisFromRFC822String(Object rfc822); @SuppressWarnings("unchecked") static String getNestedKeyValue(Map<String, Object> event, String key); static Long getTimeInMillis(); static Long getTimeInNanos(); static String getValue(Map<String, Object> event, String key); static boolean isContains(Object object, String key); static boolean isNameOrAliasEqual(Map<String, String> attribute, String name); static boolean isVersionEqualOrGreaterThan(Object versionBase, Object versionValue); static Object[] removeElement(Object[] array, Object entryToRemove); @SuppressWarnings("unchecked") static List<Map<Object, Object>> removeKeyAndConvertToListOfMaps(Object obj, String key); static Object[] sliceArray(Object[] objArray, String keys); static Object sliceObject(Object obj, String keys); static String toLowerCase(String str); static String[] toLowerCase(String[] strArray); @SuppressWarnings("unchecked") static Map<String, Object>[] toStream1(Object[] array); static Map<String, Class> toStream1Metadata(); @SuppressWarnings("unchecked") static Map<String, Object>[] toStream2(Object[] array1, Object[] array2); static Map<String, Class> toStream2Metadata(); @SuppressWarnings("unchecked") static Map<String, Object>[] toStream3(Object[] array1, Object[] array2, Object[] array3); static Map<String, Class> toStream3Metadata(); static String toUpperCase(String str); static String[] toUpperCase(String[] strArray); static String transformToJsonString(Object obj); @SuppressWarnings("unchecked") static HashMap<String, Object> transformToObjectAndRemoveKey(String jsonStr, String key);  }
@Test public void testFindIntersection() { Map<String, Object> map1 = new HashMap<String, Object>(); Map<String, Object> map2 = new HashMap<String, Object>(); map1.put("score1", 0.0888676767676767676767676767); map2.put("score1", 0.0888676767676767676767676767); System.out.println(EPLUtilities.findIntersection(map1, map2)); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 0); map1.put("score1", 0.0); map2.put("score1", 0.2); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 1); clearSets(map1, map2); map1.put("score1", 0.0); map2.put("score1", 0.1); map2.put("score2", 0.2); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 2); clearSets(map1, map2); map1.put("score1", "234"); map2.put("score1", "234"); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 0); clearSets(map1, map2); map1.put("score1", "234"); map2.put("score1", "234.4"); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 1); clearSets(map1, map2); map1.put("score1", "234"); map2.put("score1", "234.4"); map2.put("score2", "234.4"); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 2); clearSets(map1, map2); map1.put("score1", 234L); map2.put("score1", 234L); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 0); clearSets(map1, map2); map1.put("score1", 234L); map2.put("score1", 235L); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 1); clearSets(map1, map2); map1.put("score1", 234L); map2.put("score1", 235L); map2.put("score2", 4444L); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 2); clearSets(map1, map2); map1.put("score1", 234.5565f); map2.put("score1", 234.5565f); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 0); clearSets(map1, map2); map1.put("score1", 234.5f); map2.put("score1", 235f); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 1); clearSets(map1, map2); map1.put("score1", 234.5f); map2.put("score1", 235f); map2.put("score2", 666f); assertEquals(EPLUtilities.findIntersection(map1, map2).size(), 2); }