jodd-core/src/main/java/jodd/util/BinarySearch.java
public static <T extends Comparable> BinarySearch<T> forArray(final T[] array) {
		return new BinarySearch<T>() {
			@Override
			@SuppressWarnings( {"unchecked"})
			protected int compare(final int index, final T element) {
				return array[index].compareTo(element);
			}

			@Override
			protected int getLastIndex() {
				return array.length - 1;
			}
		};
	}
public static <T extends Comparable> BinarySearch<T> forArray(final T[] array) {
		return new BinarySearch<T>() {
			@Override
			@SuppressWarnings( {"unchecked"})
			protected int compare(final int index, final T element) {
				return array[index].compareTo(element);
			}

			@Override
			protected int getLastIndex() {
				return array.length - 1;
			}
		};
	}
public static < T extends Comparable > BinarySearch < T > forArray ( final T [ ] array ) { return new BinarySearch < T > ( ) { @ Override @ SuppressWarnings ( { "unchecked" } ) protected int compare ( final int index , final T element ) { return array [ index ] . compareTo ( element ) ; } @ Override protected int getLastIndex ( ) { return array . length - 1 ; } } ; }
Creates binary search wrapper over an array.
Creates binary search wrapper over an array .