-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Search submodule which initially includes binary search
- Loading branch information
Showing
14 changed files
with
1,487 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
function/src/main/java/io/smallrye/common/function/ExceptionObjIntFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.smallrye.common.function; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* A function which operates on an object and an integer, yielding an object. | ||
*/ | ||
public interface ExceptionObjIntFunction<T, R, E extends Exception> { | ||
R apply(T arg1, int arg2) throws E; | ||
|
||
default <V> ExceptionObjIntFunction<T, V, E> andThen(ExceptionFunction<? super R, ? extends V, ? extends E> after) | ||
throws E { | ||
Objects.requireNonNull(after); | ||
return (T t, int u) -> after.apply(apply(t, u)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
function/src/main/java/io/smallrye/common/function/ExceptionObjIntPredicate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.smallrye.common.function; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* A predicate that operates on an object and an integer. | ||
*/ | ||
public interface ExceptionObjIntPredicate<T, E extends Exception> { | ||
boolean test(T object, int value) throws E; | ||
|
||
default ExceptionObjIntPredicate<T, E> and(ExceptionObjIntPredicate<? super T, ? extends E> other) { | ||
Objects.requireNonNull(other); | ||
return (t, i) -> test(t, i) && other.test(t, i); | ||
} | ||
|
||
default ExceptionObjIntPredicate<T, E> negate() { | ||
return (t, i) -> !test(t, i); | ||
} | ||
|
||
default ExceptionObjIntPredicate<T, E> or(ExceptionObjIntPredicate<? super T, ? extends E> other) { | ||
Objects.requireNonNull(other); | ||
return (t, i) -> test(t, i) || other.test(t, i); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
function/src/main/java/io/smallrye/common/function/ExceptionObjLongFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.smallrye.common.function; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* A function which operates on an object and a long integer, yielding an object. | ||
*/ | ||
public interface ExceptionObjLongFunction<T, R, E extends Exception> { | ||
R apply(T arg1, long arg2) throws E; | ||
|
||
default <V> ExceptionObjLongFunction<T, V, E> andThen(ExceptionFunction<? super R, ? extends V, ? extends E> after) | ||
throws E { | ||
Objects.requireNonNull(after); | ||
return (T t, long u) -> after.apply(apply(t, u)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
function/src/main/java/io/smallrye/common/function/ExceptionObjLongPredicate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.smallrye.common.function; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* A predicate that operates on an object and a long integer. | ||
*/ | ||
public interface ExceptionObjLongPredicate<T, E extends Exception> { | ||
boolean test(T object, long value); | ||
|
||
default ExceptionObjLongPredicate<T, E> and(ExceptionObjLongPredicate<? super T, ? extends E> other) { | ||
Objects.requireNonNull(other); | ||
return (t, i) -> test(t, i) && other.test(t, i); | ||
} | ||
|
||
default ExceptionObjLongPredicate<T, E> negate() { | ||
return (t, i) -> !test(t, i); | ||
} | ||
|
||
default ExceptionObjLongPredicate<T, E> or(ExceptionObjLongPredicate<? super T, ? extends E> other) { | ||
Objects.requireNonNull(other); | ||
return (t, i) -> test(t, i) || other.test(t, i); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
function/src/main/java/io/smallrye/common/function/ObjIntFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.smallrye.common.function; | ||
|
||
import java.util.Objects; | ||
import java.util.function.Function; | ||
|
||
/** | ||
* A function which operates on an object and an integer, yielding an object. | ||
*/ | ||
public interface ObjIntFunction<T, R> { | ||
R apply(T arg1, int arg2); | ||
|
||
default <V> ObjIntFunction<T, V> andThen(Function<? super R, ? extends V> after) { | ||
Objects.requireNonNull(after); | ||
return (T t, int u) -> after.apply(apply(t, u)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
function/src/main/java/io/smallrye/common/function/ObjIntPredicate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.smallrye.common.function; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* A predicate that operates on an object and an integer. | ||
*/ | ||
public interface ObjIntPredicate<T> { | ||
boolean test(T object, int value); | ||
|
||
default ObjIntPredicate<T> and(ObjIntPredicate<? super T> other) { | ||
Objects.requireNonNull(other); | ||
return (t, i) -> test(t, i) && other.test(t, i); | ||
} | ||
|
||
default ObjIntPredicate<T> negate() { | ||
return (t, i) -> !test(t, i); | ||
} | ||
|
||
default ObjIntPredicate<T> or(ObjIntPredicate<? super T> other) { | ||
Objects.requireNonNull(other); | ||
return (t, i) -> test(t, i) || other.test(t, i); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
function/src/main/java/io/smallrye/common/function/ObjLongFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.smallrye.common.function; | ||
|
||
import java.util.Objects; | ||
import java.util.function.Function; | ||
|
||
/** | ||
* A function which operates on an object and a long integer, yielding an object. | ||
*/ | ||
public interface ObjLongFunction<T, R> { | ||
R apply(T arg1, long arg2); | ||
|
||
default <V> ObjLongFunction<T, V> andThen(Function<? super R, ? extends V> after) { | ||
Objects.requireNonNull(after); | ||
return (T t, long u) -> after.apply(apply(t, u)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
function/src/main/java/io/smallrye/common/function/ObjLongPredicate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.smallrye.common.function; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* A predicate that operates on an object and a long integer. | ||
*/ | ||
public interface ObjLongPredicate<T> { | ||
boolean test(T object, long value); | ||
|
||
default ObjLongPredicate<T> and(ObjLongPredicate<? super T> other) { | ||
Objects.requireNonNull(other); | ||
return (t, i) -> test(t, i) && other.test(t, i); | ||
} | ||
|
||
default ObjLongPredicate<T> negate() { | ||
return (t, i) -> !test(t, i); | ||
} | ||
|
||
default ObjLongPredicate<T> or(ObjLongPredicate<? super T> other) { | ||
Objects.requireNonNull(other); | ||
return (t, i) -> test(t, i) || other.test(t, i); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.smallrye.common</groupId> | ||
<artifactId>smallrye-common-parent</artifactId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>smallrye-common-search</artifactId> | ||
|
||
<name>SmallRye Common: Search</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>smallrye-common-function</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<profiles> | ||
<profile> | ||
<id>coverage</id> | ||
<properties> | ||
<argLine>@{jacocoArgLine}</argLine> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>report</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>report</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
|
||
</project> |
Oops, something went wrong.