src/main/java/chlx/hashing/similarity/JaccardIndex.java
public static double index(@NotNull Object[] s1, @NotNull Object[] s2) {
		if (s1.length == 0 && s2.length == 0) {
			return 1.0;
		}
		int count = 0;
		for (Object i : s1) {
			if (Arrays.binarySearch(s2, i) >= 0) {
				count++;
			}
		}
		return (double) count / (s1.length + s2.length - count);
	}
/**
	 * Calculate similarity between 2 sorted arrays
	 */
Calculate similarity between 2 sorted arrays
Calculate similarity between 2 sorted arrays
public static double index(@NotNull Object[] s1, @NotNull Object[] s2) {
		if (s1.length == 0 && s2.length == 0) {
			return 1.0;
		}
		int count = 0;
		for (Object i : s1) {
			if (Arrays.binarySearch(s2, i) >= 0) {
				count++;
			}
		}
		return (double) count / (s1.length + s2.length - count);
	}
public static double index ( @ NotNull Object [ ] s1 , @ NotNull Object [ ] s2 ) { if ( s1 . length == 0 && s2 . length == 0 ) { return 1.0 ; } int count = 0 ; for ( Object i : s1 ) { if ( Arrays . binarySearch ( s2 , i ) >= 0 ) { count ++ ; } } return ( double ) count / ( s1 . length + s2 . length - count ) ; }
Calculate similarity between 2 sorted arrays
Calculate similarity between 2 sorted arrays