src/main/java/chlx/hashing/similarity/JaccardIndex.java
public static double index(@NotNull List<Long> s1, @NotNull List<Long> s2) {
		if (s1.size() == 0 && s2.size() == 0) {
			return 1.0;
		}
		int count = 0;

		int i1 = 0;
		int i2 = 0;
		while (i1 < s1.size() && i2 < s2.size()) {
			if (s1.get(i1) < s2.get(i2)) {
				++i1;
			} else if (s2.get(i2) < s1.get(i1)) {
				++i2;
			} else {
				++count;
				++i1;
				++i2;
			}
		}

		return (double) count / (s1.size() + s2.size() - count);
	}
/**
	 * Calculate similarity between 2 sorted int list
	 */
Calculate similarity between 2 sorted int list
Calculate similarity between 2 sorted int list
public static double index(@NotNull List<Long> s1, @NotNull List<Long> s2) {
		if (s1.size() == 0 && s2.size() == 0) {
			return 1.0;
		}
		int count = 0;
		int i1 = 0;
		int i2 = 0;
		while (i1 < s1.size() && i2 < s2.size()) {
			if (s1.get(i1) < s2.get(i2)) {
				++i1;
			} else if (s2.get(i2) < s1.get(i1)) {
				++i2;
			} else {
				++count;
				++i1;
				++i2;
			}
		}
		return (double) count / (s1.size() + s2.size() - count);
	}
public static double index ( @ NotNull List < Long > s1 , @ NotNull List < Long > s2 ) { if ( s1 . size ( ) == 0 && s2 . size ( ) == 0 ) { return 1.0 ; } int count = 0 ; int i1 = 0 ; int i2 = 0 ; while ( i1 < s1 . size ( ) && i2 < s2 . size ( ) ) { if ( s1 . get ( i1 ) < s2 . get ( i2 ) ) { ++ i1 ; } else if ( s2 . get ( i2 ) < s1 . get ( i1 ) ) { ++ i2 ; } else { ++ count ; ++ i1 ; ++ i2 ; } } return ( double ) count / ( s1 . size ( ) + s2 . size ( ) - count ) ; }
Calculate similarity between 2 sorted int list
Calculate similarity between 2 sorted int list